GithubHelp home page GithubHelp logo

imagicbell / ublockly Goto Github PK

View Code? Open in Web Editor NEW
135.0 15.0 51.0 1.46 MB

reimplementation of google blockly for Unity

Home Page: http://imagicbell.github.io/unity/2017/10/11/blockly-one.html

License: Apache License 2.0

C# 100.00%
blockly unity

ublockly's People

Contributors

imagicbell avatar qqshfox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ublockly's Issues

Procedures blocks problem

Hello, I have 3 question.

  1. When I rename block: procedure name on canvas , the block doesn't update block label at the first time, rename block again the label will update the name which I updated at first time, not the second one, is it a bug?

  2. When I drag a block:procedure on canvas and add some statement in block and run, everything work is fine. but save xml, then load xml, the block: procedure can't work property, is it a bug?

  3. When I drag a block:procedure to canvas, then drag the latest block which auto created from toolbox to canvas, click the left top gear icon, it show "Exception: Can't find dialog prefab for procedures_callnoreturn_mutator, Please ensure you configure it in "BlockResSettings", I can add "procedures_callnoreturn_mutator" in BlockResSettings, but I can't found any prefab or script like "ProcedureCallMutatorDialog", is it a unfinished part?

Thanks for help.

Show images in blocks

Hello,

Is it possible to show images/icons in PNG or JPG format inside the blocks? In the official Blockly it is possible with this code:

{
  "type": "uc3m_light_off_img",
  "message0": "%1",
  "args0": [
    {
      "type": "field_image",
      "src": "https://cdn4.iconfinder.com/data/icons/ui-controls-miscellaneous/32/interface-controls-light-bulb-off-512.png",
      "width": 30,
      "height": 30,
      "alt": "LED off",
      "flipRtl": false
    }
  ],
  "previousStatement": null,
  "nextStatement": null,
  "colour": 50,
  "tooltip": "Turn the LED off",
  "helpUrl": ""
  },

Thanks!

Can't drag any block when build the project

Hi,

I've been keeping working with UBlockly and I have found the problem that, when I build the project, I can´t drag and drop any block in the Canvas. I tried to build the same project for windows and WebGL and It doesn't work in any of them. However, I don't know why, because when I run it directly form the Unity editor, works fine.

I would be so grateful If someone can tell me what is happens or help me In some way.

Thanks in advance.

Getting a error on trying to ignore some block categories

Hello there.
I'm trying to read only some block categories depending on the integrated sensors from our program. I'm trying to continue the loop if the sensor readed is not integrated. Although, it keeps giving me this ArgumentNullException: value cannot be null Parameter name: collection error. Could you give me some help trying to understand what can possibly be going on? Thanks in advance!

Trying to ignore some resParams from the m_BlockJsonFiles in BlockResMgr.cs

Imgur

中文显示bug

自定义中文blockly之后,拖动到xmlpanel上面,中文就成乱码了。
bug

Create new blocks

Hi,

The explaination about creating new blocks is pretty confusing.

I create a new category in toolbox_default.json and its content is now:

     "Style": "classic",
     "BlockCategoryList": [
          {
               "CategoryName": "CONTROL",
               "ColorHex": "#669966",
               "BlockTypePrefix": "controls"
          },
          {
               "CategoryName": "MATH",
               "ColorHex": "#4668a5",
               "BlockTypePrefix": "math"
          },
          {
               "CategoryName": "TEXT",
               "ColorHex": "#f6546a",
               "BlockTypePrefix": "text"
          },
          {
               "CategoryName": "ARDUINO",
               "ColorHex": "#f6546a",
               "BlockTypePrefix": "uc3marduino"
          }
     ]
}

Then, I create a new file in the folder \Assets\UBlockly\JsonBlocks\ called uc3marduino.json with content (just to try if it works):

  {
    "type": "uc3marduino_t",
    "message0": "\" %1 \"",
    "args0": [{
      "type": "field_input",
      "name": "TEXT",
      "text": ""
    }],
    "output": "String",
    "colour": "%{BKY_TEXT_HUE}",
    "helpUrl": "%{BKY_TEXT_TEXT_HELPURL}",
    "tooltip": "%{BKY_TEXT_TEXT_TOOLTIP}",
    "extensions": [
      "text_quotes",
      "parent_tooltip_when_inline"
    ]
  }
]

Then, I modify the file UBlocklyData\Resources\BlockResSettings.assets:

 - IndexName: variables
    ResName: variables
    TextFile: {fileID: 4900000, guid: d0e6cc79a30de40e6ab2a13928a03d85, type: 3}
  - IndexName: uc3mandroid
    ResName: uc3mandroid
    TextFile: {fileID: 4900000, guid: d0e6cc79a30de40e6ab2a13928a03d86, type: 3}
  m_ToolboxFiles:
  - IndexName: default
    ResName: toolbox_default
    TextFile: {fileID: 4900000, guid: 5c0bdd5df6d904a27af2a1b56125a6e0, type: 3}
    Selected: 1
  m_BlockViewPrefabPath: Assets/UBlocklyData/BlockGenPrefabs/
  m_BlockViewPrefabs:
  - IndexName: colour_picker
    ResName: Block_colour_picker
    Prefab: {fileID: 1465611821804190, guid: 9c45cd753686049bea63954b59419ac3, type: 2}
...

Can anyone tell what I miss? I get error:

Parameter name: collection
System.ThrowHelper.ThrowArgumentNullException (System.ExceptionArgument argument) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Collections.Generic.List`1[T].InsertRange (System.Int32 index, System.Collections.Generic.IEnumerable`1[T] collection) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Collections.Generic.List`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] collection) (at <695d1cc93cca45069c528c15c9fdd749>:0)
UBlockly.UGUI.ToolboxBlockCategory.Init () (at Assets/UBlockly/Script/UGUIView/Toolbox/ToolboxConfig.cs:69)
UBlockly.UGUI.ToolboxConfig.Load () (at Assets/UBlockly/Script/UGUIView/Toolbox/ToolboxConfig.cs:45)
UBlockly.UGUI.WorkspaceView.BindModel (UBlockly.Workspace workspace) (at Assets/UBlockly/Script/UGUIView/WorkspaceView.cs:62)
UBlockly.UGUI.BlocklyUI.NewWorkspace () (at Assets/UBlockly/Script/UGUIView/BlocklyUI.cs:38)
UBlockly.UGUI.WorkspaceView.Awake () (at Assets/UBlockly/Script/UGUIView/WorkspaceView.cs:169)

I need help

We are a team of universitary students working on an interactive rocket simulator from scratch. We need to implement or integrate a block based programming in our project and we would love to integrate your work. Although, we are having issues trying to run your examples from the repository. I've tried to contact you, because we're kinda desperate. Could you please give us a little help on how to run your example with unity?
Thanks in advance!

Is there a context menu function?

Hello, thanks for open this great project!! but It's sad that there's no undo function. Or maybe I couldn't find it.
If you right-click block on Blockly, you'll find a context menu. And you can use several functions. Like "Duplicate", "Add Comment" etc. UBlockly doesn't have this function? (I saw the explanation "context menu" in "en.json")

Integration in Oculus Quest 2

Hi,

I would like to use this project in a virtual world created for Oculus Quest 2.
Is there any way to visualize this program in a Canvas? I mean, I do not want the program to take all the space, I want to embed it in my virtual world, as shown in the attachment.

Thanks!
Screenshot 2021-07-21 105307

How to change language?

I've created a new i18n file with my language and added a new list item to BlockResSettings. Although, nothing changes when I run the game.

blockly unity需求

您好,我司最近在寻找blockly在unity上的功能实现支持,看到您做了次项目,不知是否有兴趣联系合作一下,我微信johnnowang,欢迎交流。

Next statement without a previous statement

Recently, I've been trying to implement a "start" block, so that the interpreter only reads the code that's hanging from this block. However, I found myself unable to do it: whether it is a mistake of mine, or a bug, I don't know although I believe it is the later.

When trying to write the .json file that describes the block structure, I noticed that I can add a "previousStatement" to a block, which adds a link to the block, so that it can be connected to others, or even a "previousStatement" and a "nextStatement", as in the pictures below:

image
image

image
image

Yet, when I try to add only a "nextStatement" (which is what the Start block should have), the result isn't the expected:

image
image

Blocks are not correctly deleted when a variable is deleted

There is a problem when the user sets the blocks like this:
image

And later on they choose to delete the variable (not the variables_set block, but the variable itself), using the delete variable option from the variables_set block (like below):
image

The variables_set is removed and the rest of the blocks still exist, which would seem like a normal behavior:
image

But, if the user then tries to move the math block, these exceptions appear:
image

This block can no longer be erased or connected to other blocks.

Compiler to check errors

Hello again!

We have a huge doubt that can require some work, but we would like to know your opinion and to get some advice.

For our game we want to verify if the code has any errors like missing inputs before running the code, to ensure we can perform a state transition and actually run the code without running into errors if the user forgets something.
Do you think it is easy or even possible to make kind of a compiler to iterate through all blocks of code and search for those kind of errors before having to actually execute the code?

Thanks in advance!

Can't run the example project

Hi,

I have forked and cloned this repo a few hours ago and when I tried to run "Example" directory in Unity, I can't do anything. It only has an empty scene with a "Main Camera" and a "Directional Light" in the Hierarchy. Also in the Assets I have "UBlockly" and "UblocklyData" but I can't execute them either.

So I would be so grateful if you can help me or tell me if I'm doing anything wrong.

Thanks

Snap fails in some blocks

Hi while developing our project we've encountered an issue with the snapping in long blocks. It seems that the connections positions doesn't update when we add code blocks. For example in the for block if we had 5 instructions, to add a new block at the bottom of the for we have to drag the block not to the bottom of the for block but to the middle of it.
I've attached a video showing what i mean in case it's not clear. Is there a way to fix this or a way to improve the snapping.? Thanks

2021-05-24.20-33-08.mp4

BtnCreateVar didn't support i18n

` //build createVar button
GameObject obj = GameObject.Instantiate(BlockViewSettings.Get().PrefabBtnCreateVar);

        obj.GetComponentInChildren<Text>().text = "创建变量";`

"Debug" Mode

Hi, looking through the code we were wondering if there was a way of "debugging" the blocks( i.e stopping the execution and going block by block), and if it's not implemented we would like to know if it's possible and in that case what would we have to do. Thanks for your time.

Block has default input blocks ?

Hello,
I want to do : when user drag block(math_arithmetic) on canvas, it default has to 2 block(math_number) in the block(math_arithmetic) slots, not 2 empty slot.

Is it possible to do that ? can you give me some tip?
Thanks.

Logic_compare insert to Logic_compare cause StackOverflowException

Hello:

I have one problem, here is reproduce step:
Step1 : Drag Block(Logic_compare) into workspace from toolbox.
Step2: Drag Block(logic_operation) from toolbox and insert to the first slot of Block(Logic_compare).
Step3: Drag Block(Logic_compare) created from Step1 and drop.

it show "StackOverflowException: The requested operation caused a stack overflow."
and the connect highlight icon appear in Block(Logic_compare) first slot?

Can you help me? thanks very much

Does UBlockly support Unity Testing?

Whenever we add new block, we need to check if it works fine and also need to test if all the previous blocks are working fine or not. There have been cases where we did a few changes to solve issues which in-turn introduced new issues.

It would be great to have automated/unit testing feature, so as to test all blocks whenever we add new blocks or do any major changes. This will make sure that new changes have not affected any previous functionality.

Blockly Unit Testing Page: https://developers.google.com/blockly/guides/modify/web/unit-testing
I would like to ask if this is already possible (if yes then how?) or can it be possible (if yes, how can we do so)?

Thanks in advance.

Is possible has one more input_value in one row?

Hello:

My defined block has 4 input_value, every row only has 1 input_value.
I wish every row has 2 input_value, after try 2 pair message & args, and try "align" tag, both not works.
only choice is set "inputsInline": true: 4 input_value in one row, but when insert 4 block in my block, it looks so long.

Is it possible define how many input_value in each row?

my block just like
{ "type": "myblock", "message0": "A:%1 B:%2 C:%3 D:%4", "args0": [ {"type": "input_value","name": "A"}, {"type": "input_value","name": "B"}, {"type": "input_value","name": "C"}, {"type": "input_value","name": "D"} ], "previousStatement": null, "nextStatement": null }

Thanks.

How to use only Interpreter?

First thanks, this project is very great! But I want use interpreter only..
(I want to use the xml I created from my blockly web site.)

Can you make a simple example or tips?

1. 用json定义该block,参考built-in blocks (/Source/JsonBlocks/ 目录下);

  1. 用json定义该block,参考built-in blocks (/Source/JsonBlocks/ 目录下);
  2. 如果使用C#,解释该Block的行为(code interpreter),参考built-in blocks (/Source/Script/CodeDB/CSharp/Interpreters/ 目录下);
    3.如果使用Lua,为该Block生成Lua代码(code generator),参考built-in blocks (/Source/Script/CodeDB/Lua/Generators/ 目录下);
    4.如果是特殊的block(带有变形功能),需要提供可供编辑变形的UI。(这一步比较麻烦,可能你并不需要)

Originally posted by @imagicbell in #3 (comment)

What is the colour/tooltip/helpurl paremeters in the json block configuration files used for?

Hi there, We are trying to use the ublockly library and we are having some doubts about the usage of some of the parameters used in the JSON block definition.
The 3 parameters we have in doubt are the colour/helpUrl/tooltip parameters.,
We supposed the colour was used to change the colour of the block but when we tried to change it nothing happened.
The fields helpurl, tooltip we have no idea what they are used for.

Any help would be appreciated, thanks. 😃

The user can create infinite loops

The player can add blocks to the workspace to create infinite loops that crash the app. Code blocks like while true or an infinite recursive function are permited. Maybe as a fix the app could put a max number of iterations so if it passes that number it stops executing the code.

自定义block,没有下一条语句的连接点(突出小半圆)

{
"type": "crvprogram_start",
"message0": "Start",
"nextStatement":null,
"tooltip": "",
"helpUrl":""
}

我按照上面的json样式,自定义了block,目前只显示一个圆角矩形(没有突出的小半圆)。

加上"previousStatement": null ,就有了下一条语句的连接点,当然上一条语句的缩进的小半圆连接点也有了。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.