├── .github
└── workflows
│ └── ci.yml
├── .gitignore
├── Doc
├── blockressettings.png
├── changeui_1.png
├── changeui_2.png
├── glimpse.png
├── google_ui.png
├── settings1.png
├── settings2.png
└── sratch_ui.png
├── Examples
├── Assets
│ ├── UBlockly
│ ├── UBlockly.meta
│ ├── UBlocklyData
│ └── UBlocklyData.meta
├── Packages
│ ├── manifest.json
│ └── packages-lock.json
└── ProjectSettings
│ ├── AudioManager.asset
│ ├── ClusterInputManager.asset
│ ├── DynamicsManager.asset
│ ├── EditorBuildSettings.asset
│ ├── EditorSettings.asset
│ ├── GraphicsSettings.asset
│ ├── InputManager.asset
│ ├── NavMeshAreas.asset
│ ├── NetworkManager.asset
│ ├── PackageManagerSettings.asset
│ ├── Physics2DSettings.asset
│ ├── PresetManager.asset
│ ├── ProjectSettings.asset
│ ├── ProjectVersion.txt
│ ├── QualitySettings.asset
│ ├── SceneTemplateSettings.json
│ ├── TagManager.asset
│ ├── TimeManager.asset
│ ├── UnityConnectSettings.asset
│ ├── VFXManager.asset
│ └── VersionControlSettings.asset
├── LICENSE
├── README.md
├── Source
├── Example.meta
├── Example
│ ├── UGUIDemo.unity
│ └── UGUIDemo.unity.meta
├── JsonBlocks.meta
├── JsonBlocks
│ ├── colour.json
│ ├── colour.json.meta
│ ├── coroutine.json
│ ├── coroutine.json.meta
│ ├── lists.json
│ ├── lists.json.meta
│ ├── logic.json
│ ├── logic.json.meta
│ ├── loops.json
│ ├── loops.json.meta
│ ├── math.json
│ ├── math.json.meta
│ ├── procedures.json
│ ├── procedures.json.meta
│ ├── text.json
│ ├── text.json.meta
│ ├── variables.json
│ └── variables.json.meta
├── Libs.meta
├── Libs
│ ├── JsonExtension.cs
│ ├── JsonExtension.cs.meta
│ ├── Newtonsoft.Json.dll
│ └── Newtonsoft.Json.dll.meta
├── Script.meta
├── Script
│ ├── CodeDB.meta
│ ├── CodeDB
│ │ ├── CSharp.meta
│ │ ├── CSharp
│ │ │ ├── CSharp.cs
│ │ │ ├── CSharp.cs.meta
│ │ │ ├── CSharpGenerator.cs
│ │ │ ├── CSharpGenerator.cs.meta
│ │ │ ├── CSharpInterpreter.cs
│ │ │ ├── CSharpInterpreter.cs.meta
│ │ │ ├── CSharpRunner.cs
│ │ │ ├── CSharpRunner.cs.meta
│ │ │ ├── Generators.meta
│ │ │ ├── Generators
│ │ │ │ ├── Coroutine_CSharp.cs
│ │ │ │ ├── Coroutine_CSharp.cs.meta
│ │ │ │ ├── Logic_CSharp.cs
│ │ │ │ ├── Logic_CSharp.cs.meta
│ │ │ │ ├── Loop_CSharp.cs
│ │ │ │ ├── Loop_CSharp.cs.meta
│ │ │ │ ├── Math_CSharp.cs
│ │ │ │ ├── Math_CSharp.cs.meta
│ │ │ │ ├── Text_CSharp.cs
│ │ │ │ ├── Text_CSharp.cs.meta
│ │ │ │ ├── Variables_CSharp.cs
│ │ │ │ └── Variables_CSharp.cs.meta
│ │ │ ├── Interpreters.meta
│ │ │ └── Interpreters
│ │ │ │ ├── Coroutine_CSharp.cs
│ │ │ │ ├── Coroutine_CSharp.cs.meta
│ │ │ │ ├── List_CSharp.cs
│ │ │ │ ├── List_CSharp.cs.meta
│ │ │ │ ├── Logic_CSharp.cs
│ │ │ │ ├── Logic_CSharp.cs.meta
│ │ │ │ ├── Loop_CSharp.cs
│ │ │ │ ├── Loop_CSharp.cs.meta
│ │ │ │ ├── Math_CSharp.cs
│ │ │ │ ├── Math_CSharp.cs.meta
│ │ │ │ ├── Procedure_CSharp.cs
│ │ │ │ ├── Procedure_CSharp.cs.meta
│ │ │ │ ├── Text_CSharp.cs
│ │ │ │ ├── Text_CSharp.cs.meta
│ │ │ │ ├── Variables_CSharp.cs
│ │ │ │ └── Variables_CSharp.cs.meta
│ │ ├── Lua.meta
│ │ └── Lua
│ │ │ ├── Generators.meta
│ │ │ ├── Generators
│ │ │ ├── Colour_Lua.cs
│ │ │ ├── Colour_Lua.cs.meta
│ │ │ ├── List_Lua.cs
│ │ │ ├── List_Lua.cs.meta
│ │ │ ├── Logic_Lua.cs
│ │ │ ├── Logic_Lua.cs.meta
│ │ │ ├── Loop_Lua.cs
│ │ │ ├── Loop_Lua.cs.meta
│ │ │ ├── Math_Lua.cs
│ │ │ ├── Math_Lua.cs.meta
│ │ │ ├── Procedure_Lua.cs
│ │ │ ├── Procedure_Lua.cs.meta
│ │ │ ├── Text_Lua.cs
│ │ │ ├── Text_Lua.cs.meta
│ │ │ ├── Variables_Lua.cs
│ │ │ └── Variables_Lua.cs.meta
│ │ │ ├── Lua.cs
│ │ │ ├── Lua.cs.meta
│ │ │ ├── LuaGenerator.cs
│ │ │ ├── LuaGenerator.cs.meta
│ │ │ ├── LuaInterpreter.cs
│ │ │ ├── LuaInterpreter.cs.meta
│ │ │ ├── LuaRunner.cs
│ │ │ └── LuaRunner.cs.meta
│ ├── Core.meta
│ ├── Core
│ │ ├── Block.meta
│ │ ├── Block
│ │ │ ├── Block.cs
│ │ │ ├── Block.cs.meta
│ │ │ ├── BlockDefinition.cs
│ │ │ ├── BlockDefinition.cs.meta
│ │ │ ├── BlockFactory.cs
│ │ │ └── BlockFactory.cs.meta
│ │ ├── Blockly.cs
│ │ ├── Blockly.cs.meta
│ │ ├── Code.meta
│ │ ├── Code
│ │ │ ├── CmdEnumerator.cs
│ │ │ ├── CmdEnumerator.cs.meta
│ │ │ ├── CmdRunner.cs
│ │ │ ├── CmdRunner.cs.meta
│ │ │ ├── Cmdtor.cs
│ │ │ ├── Cmdtor.cs.meta
│ │ │ ├── CodeDefs.cs
│ │ │ ├── CodeDefs.cs.meta
│ │ │ ├── Datas.cs
│ │ │ ├── Datas.cs.meta
│ │ │ ├── Generator.cs
│ │ │ ├── Generator.cs.meta
│ │ │ ├── Interpreter.cs
│ │ │ ├── Interpreter.cs.meta
│ │ │ ├── Names.cs
│ │ │ ├── Names.cs.meta
│ │ │ ├── Runner.cs
│ │ │ └── Runner.cs.meta
│ │ ├── Connection.meta
│ │ ├── Connection
│ │ │ ├── Connection.cs
│ │ │ ├── Connection.cs.meta
│ │ │ ├── ConnectionDB.cs
│ │ │ └── ConnectionDB.cs.meta
│ │ ├── CustomDefine.meta
│ │ ├── CustomDefine
│ │ │ ├── Number.cs
│ │ │ ├── Number.cs.meta
│ │ │ ├── ObservePattern.cs
│ │ │ ├── ObservePattern.cs.meta
│ │ │ ├── Vector.cs
│ │ │ └── Vector.cs.meta
│ │ ├── Define.cs
│ │ ├── Define.cs.meta
│ │ ├── Field.meta
│ │ ├── Field
│ │ │ ├── Field.cs
│ │ │ ├── Field.cs.meta
│ │ │ ├── FieldAngle.cs
│ │ │ ├── FieldAngle.cs.meta
│ │ │ ├── FieldCheckbox.cs
│ │ │ ├── FieldCheckbox.cs.meta
│ │ │ ├── FieldColour.cs
│ │ │ ├── FieldColour.cs.meta
│ │ │ ├── FieldDate.cs
│ │ │ ├── FieldDate.cs.meta
│ │ │ ├── FieldDropdown.cs
│ │ │ ├── FieldDropdown.cs.meta
│ │ │ ├── FieldFactory.cs
│ │ │ ├── FieldFactory.cs.meta
│ │ │ ├── FieldImage.cs
│ │ │ ├── FieldImage.cs.meta
│ │ │ ├── FieldLabel.cs
│ │ │ ├── FieldLabel.cs.meta
│ │ │ ├── FieldNumber.cs
│ │ │ ├── FieldNumber.cs.meta
│ │ │ ├── FieldTextInput.cs
│ │ │ ├── FieldTextInput.cs.meta
│ │ │ ├── FieldVariable.cs
│ │ │ └── FieldVariable.cs.meta
│ │ ├── Input.meta
│ │ ├── Input
│ │ │ ├── Input.cs
│ │ │ ├── Input.cs.meta
│ │ │ ├── InputFactory.cs
│ │ │ └── InputFactory.cs.meta
│ │ ├── Mutator.meta
│ │ ├── Mutator
│ │ │ ├── Mutator.cs
│ │ │ ├── Mutator.cs.meta
│ │ │ ├── MutatorFactory.cs
│ │ │ ├── MutatorFactory.cs.meta
│ │ │ ├── Mutators.meta
│ │ │ ├── Mutators
│ │ │ │ ├── DropdownOptionsMutator.cs
│ │ │ │ ├── DropdownOptionsMutator.cs.meta
│ │ │ │ ├── IfElseMutator.cs
│ │ │ │ ├── IfElseMutator.cs.meta
│ │ │ │ ├── IndexAtMutator.cs
│ │ │ │ ├── IndexAtMutator.cs.meta
│ │ │ │ ├── ItemListMutator.cs
│ │ │ │ ├── ItemListMutator.cs.meta
│ │ │ │ ├── MathIsDivisibleByMutator.cs
│ │ │ │ └── MathIsDivisibleByMutator.cs.meta
│ │ │ ├── ProcedureMutators.meta
│ │ │ └── ProcedureMutators
│ │ │ │ ├── Procedure.cs
│ │ │ │ ├── Procedure.cs.meta
│ │ │ │ ├── ProcedureCallMutator.cs
│ │ │ │ ├── ProcedureCallMutator.cs.meta
│ │ │ │ ├── ProcedureDB.cs
│ │ │ │ ├── ProcedureDB.cs.meta
│ │ │ │ ├── ProcedureDefinitionMutator.cs
│ │ │ │ ├── ProcedureDefinitionMutator.cs.meta
│ │ │ │ ├── ProcedureMutator.cs
│ │ │ │ └── ProcedureMutator.cs.meta
│ │ ├── Utils.cs
│ │ ├── Utils.cs.meta
│ │ ├── Variable.meta
│ │ ├── Variable
│ │ │ ├── VariableMap.cs
│ │ │ ├── VariableMap.cs.meta
│ │ │ ├── VariableModel.cs
│ │ │ ├── VariableModel.cs.meta
│ │ │ ├── Variables.cs
│ │ │ └── Variables.cs.meta
│ │ ├── Workspace.cs
│ │ ├── Workspace.cs.meta
│ │ ├── Xml.cs
│ │ └── Xml.cs.meta
│ ├── I18n.meta
│ ├── I18n
│ │ ├── I18n.cs
│ │ ├── I18n.cs.meta
│ │ ├── MsgDefine.cs
│ │ └── MsgDefine.cs.meta
│ ├── Res.meta
│ ├── Res
│ │ ├── BlockResMgr.cs
│ │ └── BlockResMgr.cs.meta
│ ├── Test.meta
│ ├── Test
│ │ ├── Editor.meta
│ │ └── Editor
│ │ │ ├── Code.meta
│ │ │ ├── Code
│ │ │ ├── GeneratorTest.cs
│ │ │ └── GeneratorTest.cs.meta
│ │ │ ├── Connection.meta
│ │ │ ├── Connection
│ │ │ ├── ConnectionDBTest.cs
│ │ │ ├── ConnectionDBTest.cs.meta
│ │ │ ├── ConnectionTest.cs
│ │ │ └── ConnectionTest.cs.meta
│ │ │ ├── Field.meta
│ │ │ ├── Field
│ │ │ ├── FieldAngleTest.cs
│ │ │ ├── FieldAngleTest.cs.meta
│ │ │ ├── FieldNumberTest.cs
│ │ │ ├── FieldNumberTest.cs.meta
│ │ │ ├── FieldVariableTest.cs
│ │ │ └── FieldVariableTest.cs.meta
│ │ │ ├── InputTest.cs
│ │ │ ├── InputTest.cs.meta
│ │ │ ├── JsonTest.cs
│ │ │ ├── JsonTest.cs.meta
│ │ │ ├── TestHelper.cs
│ │ │ ├── TestHelper.cs.meta
│ │ │ ├── UtilsTest.cs
│ │ │ ├── UtilsTest.cs.meta
│ │ │ ├── VariableTest.cs
│ │ │ ├── VariableTest.cs.meta
│ │ │ ├── WorkspaceTest.cs
│ │ │ ├── WorkspaceTest.cs.meta
│ │ │ ├── XmlTest.cs
│ │ │ └── XmlTest.cs.meta
│ ├── UGUIView.meta
│ └── UGUIView
│ │ ├── BlockStatusView.cs
│ │ ├── BlockStatusView.cs.meta
│ │ ├── BlockViewBuilder.cs
│ │ ├── BlockViewBuilder.cs.meta
│ │ ├── BlockViewFactory.cs
│ │ ├── BlockViewFactory.cs.meta
│ │ ├── BlockViewSettings.cs
│ │ ├── BlockViewSettings.cs.meta
│ │ ├── BlocklyUI.cs
│ │ ├── BlocklyUI.cs.meta
│ │ ├── Dialogs.meta
│ │ ├── Dialogs
│ │ ├── BaseDialog.cs
│ │ ├── BaseDialog.cs.meta
│ │ ├── DialogFactory.cs
│ │ ├── DialogFactory.cs.meta
│ │ ├── FieldDialogs.meta
│ │ ├── FieldDialogs
│ │ │ ├── FieldAngleDialog.cs
│ │ │ ├── FieldAngleDialog.cs.meta
│ │ │ ├── FieldColorDialog.cs
│ │ │ ├── FieldColorDialog.cs.meta
│ │ │ ├── FieldDialog.cs
│ │ │ ├── FieldDialog.cs.meta
│ │ │ ├── FieldDropdownDialog.cs
│ │ │ ├── FieldDropdownDialog.cs.meta
│ │ │ ├── FieldNumberDialog.cs
│ │ │ └── FieldNumberDialog.cs.meta
│ │ ├── MsgDialog.cs
│ │ ├── MsgDialog.cs.meta
│ │ ├── MutatorDialogs.meta
│ │ ├── MutatorDialogs
│ │ │ ├── IfElseMutatorDialog.cs
│ │ │ ├── IfElseMutatorDialog.cs.meta
│ │ │ ├── ItemListMutatorDialog.cs
│ │ │ ├── ItemListMutatorDialog.cs.meta
│ │ │ ├── ProcedureDefinitionMutatorDialog.cs
│ │ │ └── ProcedureDefinitionMutatorDialog.cs.meta
│ │ ├── VariableNameDialog.cs
│ │ └── VariableNameDialog.cs.meta
│ │ ├── Editor.meta
│ │ ├── Editor
│ │ ├── BlockViewEditor.cs
│ │ └── BlockViewEditor.cs.meta
│ │ ├── Extensions.meta
│ │ ├── Extensions
│ │ ├── CustomDropdown.cs
│ │ ├── CustomDropdown.cs.meta
│ │ ├── CustomMeshImage.cs
│ │ ├── CustomMeshImage.cs.meta
│ │ ├── CustomMeshImageDefine.cs
│ │ ├── CustomMeshImageDefine.cs.meta
│ │ ├── UGUIHelper.cs
│ │ ├── UGUIHelper.cs.meta
│ │ ├── UIEventListener.cs
│ │ └── UIEventListener.cs.meta
│ │ ├── PlayControlView.cs
│ │ ├── PlayControlView.cs.meta
│ │ ├── Toolbox.meta
│ │ ├── Toolbox
│ │ ├── BaseToolbox.cs
│ │ ├── BaseToolbox.cs.meta
│ │ ├── ClassicToolbox.cs
│ │ ├── ClassicToolbox.cs.meta
│ │ ├── ScratchToolbox.cs
│ │ ├── ScratchToolbox.cs.meta
│ │ ├── ToolboxConfig.cs
│ │ └── ToolboxConfig.cs.meta
│ │ ├── Views.meta
│ │ ├── Views
│ │ ├── BaseView.cs
│ │ ├── BaseView.cs.meta
│ │ ├── BlockView.cs
│ │ ├── BlockView.cs.meta
│ │ ├── ConnectionInputView.cs
│ │ ├── ConnectionInputView.cs.meta
│ │ ├── ConnectionView.cs
│ │ ├── ConnectionView.cs.meta
│ │ ├── FieldView.cs
│ │ ├── FieldView.cs.meta
│ │ ├── Fields.meta
│ │ ├── Fields
│ │ │ ├── FieldButtonView.cs
│ │ │ ├── FieldButtonView.cs.meta
│ │ │ ├── FieldCheckboxView.cs
│ │ │ ├── FieldCheckboxView.cs.meta
│ │ │ ├── FieldColorView.cs
│ │ │ ├── FieldColorView.cs.meta
│ │ │ ├── FieldDropdownView.cs
│ │ │ ├── FieldDropdownView.cs.meta
│ │ │ ├── FieldImageView.cs
│ │ │ ├── FieldImageView.cs.meta
│ │ │ ├── FieldInputView.cs
│ │ │ ├── FieldInputView.cs.meta
│ │ │ ├── FieldLabelView.cs
│ │ │ ├── FieldLabelView.cs.meta
│ │ │ ├── FieldVariableView.cs
│ │ │ └── FieldVariableView.cs.meta
│ │ ├── InputView.cs
│ │ ├── InputView.cs.meta
│ │ ├── LineGroupView.cs
│ │ └── LineGroupView.cs.meta
│ │ ├── WorkspaceView.cs
│ │ ├── WorkspaceView.cs.meta
│ │ ├── XmlView.cs
│ │ └── XmlView.cs.meta
├── UGUI.meta
└── UGUI
│ ├── Prefabs.meta
│ ├── Prefabs
│ ├── BlockTemplates.meta
│ ├── BlockTemplates
│ │ ├── Block_root.prefab
│ │ ├── Block_root.prefab.meta
│ │ ├── Block_root_next.prefab
│ │ ├── Block_root_next.prefab.meta
│ │ ├── Block_root_output.prefab
│ │ ├── Block_root_output.prefab.meta
│ │ ├── Block_root_prev.prefab
│ │ ├── Block_root_prev.prefab.meta
│ │ ├── Block_root_prev_next.prefab
│ │ ├── Block_root_prev_next.prefab.meta
│ │ ├── Field_button.prefab
│ │ ├── Field_button.prefab.meta
│ │ ├── Field_checkbox.prefab
│ │ ├── Field_checkbox.prefab.meta
│ │ ├── Field_image.prefab
│ │ ├── Field_image.prefab.meta
│ │ ├── Field_input.prefab
│ │ ├── Field_input.prefab.meta
│ │ ├── Field_label.prefab
│ │ ├── Field_label.prefab.meta
│ │ ├── Field_variable.prefab
│ │ ├── Field_variable.prefab.meta
│ │ ├── Input_statement.prefab
│ │ ├── Input_statement.prefab.meta
│ │ ├── Input_value.prefab
│ │ ├── Input_value.prefab.meta
│ │ ├── Input_value_slot.prefab
│ │ └── Input_value_slot.prefab.meta
│ ├── BtnCreateVar.prefab
│ ├── BtnCreateVar.prefab.meta
│ ├── ConnectHighlight.prefab
│ ├── ConnectHighlight.prefab.meta
│ ├── Dialogs.meta
│ ├── Dialogs
│ │ ├── Dialog_message.prefab
│ │ ├── Dialog_message.prefab.meta
│ │ ├── Dialog_variable_name.prefab
│ │ ├── Dialog_variable_name.prefab.meta
│ │ ├── FieldDialogs.meta
│ │ ├── FieldDialogs
│ │ │ ├── Dialog_field_angle.prefab
│ │ │ ├── Dialog_field_angle.prefab.meta
│ │ │ ├── Dialog_field_color.prefab
│ │ │ ├── Dialog_field_color.prefab.meta
│ │ │ ├── Dialog_field_dropdown.prefab
│ │ │ ├── Dialog_field_dropdown.prefab.meta
│ │ │ ├── Dialog_field_number.prefab
│ │ │ └── Dialog_field_number.prefab.meta
│ │ ├── MutatorDialogs.meta
│ │ └── MutatorDialogs
│ │ │ ├── Dialog_mutator_ifelse.prefab
│ │ │ ├── Dialog_mutator_ifelse.prefab.meta
│ │ │ ├── Dialog_mutator_itemlist.prefab
│ │ │ ├── Dialog_mutator_itemlist.prefab.meta
│ │ │ ├── Dialog_mutator_proceduredef.prefab
│ │ │ └── Dialog_mutator_proceduredef.prefab.meta
│ ├── StatusLight.prefab
│ ├── StatusLight.prefab.meta
│ ├── Workspace.prefab
│ └── Workspace.prefab.meta
│ ├── Textures.meta
│ └── Textures
│ ├── Blocks.meta
│ ├── Blocks
│ ├── bg_block1.png
│ ├── bg_block1.png.meta
│ ├── bg_block2.png
│ ├── bg_block2.png.meta
│ ├── bg_common.png
│ ├── bg_common.png.meta
│ ├── connect_next.png
│ ├── connect_next.png.meta
│ ├── connect_output.png
│ ├── connect_output.png.meta
│ ├── field_dropdown.png
│ ├── field_dropdown.png.meta
│ ├── icon_mutator.png
│ ├── icon_mutator.png.meta
│ ├── img_checkmark.png
│ ├── img_checkmark.png.meta
│ ├── img_cross.png
│ ├── img_cross.png.meta
│ ├── img_edit.png
│ ├── img_edit.png.meta
│ ├── img_highlight.png
│ ├── img_highlight.png.meta
│ ├── img_statuslight.png
│ ├── img_statuslight.png.meta
│ ├── input_statement_connection.png
│ ├── input_statement_connection.png.meta
│ ├── input_value_connection.png
│ ├── input_value_connection.png.meta
│ ├── input_value_connection_slot.png
│ └── input_value_connection_slot.png.meta
│ ├── Panels.meta
│ ├── Panels
│ ├── Angle.meta
│ └── Angle
│ │ ├── field_angle.png
│ │ ├── field_angle.png.meta
│ │ ├── img_anglepanel.png
│ │ └── img_anglepanel.png.meta
│ ├── Workspace.meta
│ └── Workspace
│ ├── icon_delete_blue.png
│ ├── icon_delete_blue.png.meta
│ ├── icon_delete_red.png
│ ├── icon_delete_red.png.meta
│ ├── icon_load.png
│ ├── icon_load.png.meta
│ ├── icon_pause.png
│ ├── icon_pause.png.meta
│ ├── icon_run.png
│ ├── icon_run.png.meta
│ ├── icon_save.png
│ ├── icon_save.png.meta
│ ├── icon_step.png
│ ├── icon_step.png.meta
│ ├── icon_stop.png
│ └── icon_stop.png.meta
└── UserData
├── I18n.meta
├── I18n
├── en.json
├── en.json.meta
├── zh-hans.json
└── zh-hans.json.meta
├── Resources.meta
├── Resources
├── BlockResSettings.asset
├── BlockResSettings.asset.meta
├── BlockViewSettings.asset
└── BlockViewSettings.asset.meta
├── Toolboxs.meta
└── Toolboxs
├── Configs.meta
├── Configs
├── toolbox_default.json
└── toolbox_default.json.meta
├── Prefabs.meta
└── Prefabs
├── ClassicToolbox.prefab
├── ClassicToolbox.prefab.meta
├── ScratchToolbox.prefab
└── ScratchToolbox.prefab.meta
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on:
4 | pull_request: {}
5 | push: { branches: [master] }
6 |
7 | jobs:
8 | testAllModes:
9 | name: Test in ${{ matrix.testMode }}
10 | runs-on: ubuntu-latest
11 | strategy:
12 | fail-fast: false
13 | matrix:
14 | projectPath:
15 | - Examples
16 | testMode:
17 | - playmode
18 | - editmode
19 | steps:
20 | - uses: actions/checkout@v2
21 | with:
22 | lfs: true
23 | - uses: actions/cache@v2
24 | with:
25 | path: ${{ matrix.projectPath }}/Library
26 | key: Library-${{ matrix.projectPath }}
27 | restore-keys: |
28 | Library-
29 | - uses: game-ci/unity-test-runner@v2
30 | id: tests
31 | env:
32 | UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
33 | with:
34 | projectPath: ${{ matrix.projectPath }}
35 | testMode: ${{ matrix.testMode }}
36 | artifactsPath: ${{ matrix.testMode }}-artifacts
37 | githubToken: ${{ secrets.GITHUB_TOKEN }}
38 | checkName: ${{ matrix.testMode }} Test Results
39 | - uses: actions/upload-artifact@v2
40 | if: always()
41 | with:
42 | name: Test results for ${{ matrix.testMode }}
43 | path: ${{ steps.tests.outputs.artifactsPath }}
44 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | **/Temp/
2 | **/Library/
3 | **/obj/
4 | **.csproj
5 | **.idea/
6 | **.sln
7 |
8 | **/PersistentPath/
9 | **/PersistentPath.meta
10 | **/BlockGenPrefabs/
11 | **/BlockGenPrefabs.meta
12 | **/Xcode/
13 | **.DS_Store
14 | **.userprefs
15 | **/JetBrains/
16 | **/JetBrains.meta
17 | **/Logs/
18 | **/.vs/
19 | **/.vsconfig
20 | **/UserSettings/
21 |
--------------------------------------------------------------------------------
/Doc/blockressettings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Doc/blockressettings.png
--------------------------------------------------------------------------------
/Doc/changeui_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Doc/changeui_1.png
--------------------------------------------------------------------------------
/Doc/changeui_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Doc/changeui_2.png
--------------------------------------------------------------------------------
/Doc/glimpse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Doc/glimpse.png
--------------------------------------------------------------------------------
/Doc/google_ui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Doc/google_ui.png
--------------------------------------------------------------------------------
/Doc/settings1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Doc/settings1.png
--------------------------------------------------------------------------------
/Doc/settings2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Doc/settings2.png
--------------------------------------------------------------------------------
/Doc/sratch_ui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Doc/sratch_ui.png
--------------------------------------------------------------------------------
/Examples/Assets/UBlockly:
--------------------------------------------------------------------------------
1 | ../../Source
--------------------------------------------------------------------------------
/Examples/Assets/UBlockly.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3db2acb353f3c4b02a4f895cd2a28328
3 | folderAsset: yes
4 | timeCreated: 1509963330
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Examples/Assets/UBlocklyData:
--------------------------------------------------------------------------------
1 | ../../UserData
--------------------------------------------------------------------------------
/Examples/Assets/UBlocklyData.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: dd4c6a152b0c74a968260fa34ff72303
3 | folderAsset: yes
4 | timeCreated: 1510492528
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Examples/Packages/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "com.unity.collab-proxy": "1.3.9",
4 | "com.unity.ide.rider": "2.0.7",
5 | "com.unity.ide.visualstudio": "2.0.7",
6 | "com.unity.ide.vscode": "1.2.3",
7 | "com.unity.test-framework": "1.1.24",
8 | "com.unity.ugui": "1.0.0",
9 | "com.unity.modules.imgui": "1.0.0",
10 | "com.unity.modules.jsonserialize": "1.0.0",
11 | "com.unity.modules.ui": "1.0.0",
12 | "com.unity.modules.unitywebrequest": "1.0.0"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Examples/Packages/packages-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "com.unity.collab-proxy": {
4 | "version": "1.3.9",
5 | "depth": 0,
6 | "source": "registry",
7 | "dependencies": {},
8 | "url": "https://packages.unity.com"
9 | },
10 | "com.unity.ext.nunit": {
11 | "version": "1.0.6",
12 | "depth": 1,
13 | "source": "registry",
14 | "dependencies": {},
15 | "url": "https://packages.unity.com"
16 | },
17 | "com.unity.ide.rider": {
18 | "version": "2.0.7",
19 | "depth": 0,
20 | "source": "registry",
21 | "dependencies": {
22 | "com.unity.test-framework": "1.1.1"
23 | },
24 | "url": "https://packages.unity.com"
25 | },
26 | "com.unity.ide.visualstudio": {
27 | "version": "2.0.7",
28 | "depth": 0,
29 | "source": "registry",
30 | "dependencies": {
31 | "com.unity.test-framework": "1.1.9"
32 | },
33 | "url": "https://packages.unity.com"
34 | },
35 | "com.unity.ide.vscode": {
36 | "version": "1.2.3",
37 | "depth": 0,
38 | "source": "registry",
39 | "dependencies": {},
40 | "url": "https://packages.unity.com"
41 | },
42 | "com.unity.test-framework": {
43 | "version": "1.1.24",
44 | "depth": 0,
45 | "source": "registry",
46 | "dependencies": {
47 | "com.unity.ext.nunit": "1.0.6",
48 | "com.unity.modules.imgui": "1.0.0",
49 | "com.unity.modules.jsonserialize": "1.0.0"
50 | },
51 | "url": "https://packages.unity.com"
52 | },
53 | "com.unity.ugui": {
54 | "version": "1.0.0",
55 | "depth": 0,
56 | "source": "builtin",
57 | "dependencies": {
58 | "com.unity.modules.ui": "1.0.0",
59 | "com.unity.modules.imgui": "1.0.0"
60 | }
61 | },
62 | "com.unity.modules.imgui": {
63 | "version": "1.0.0",
64 | "depth": 0,
65 | "source": "builtin",
66 | "dependencies": {}
67 | },
68 | "com.unity.modules.jsonserialize": {
69 | "version": "1.0.0",
70 | "depth": 0,
71 | "source": "builtin",
72 | "dependencies": {}
73 | },
74 | "com.unity.modules.ui": {
75 | "version": "1.0.0",
76 | "depth": 0,
77 | "source": "builtin",
78 | "dependencies": {}
79 | },
80 | "com.unity.modules.unitywebrequest": {
81 | "version": "1.0.0",
82 | "depth": 0,
83 | "source": "builtin",
84 | "dependencies": {}
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/Examples/ProjectSettings/AudioManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Examples/ProjectSettings/AudioManager.asset
--------------------------------------------------------------------------------
/Examples/ProjectSettings/ClusterInputManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Examples/ProjectSettings/ClusterInputManager.asset
--------------------------------------------------------------------------------
/Examples/ProjectSettings/DynamicsManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Examples/ProjectSettings/DynamicsManager.asset
--------------------------------------------------------------------------------
/Examples/ProjectSettings/EditorBuildSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Examples/ProjectSettings/EditorBuildSettings.asset
--------------------------------------------------------------------------------
/Examples/ProjectSettings/EditorSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Examples/ProjectSettings/EditorSettings.asset
--------------------------------------------------------------------------------
/Examples/ProjectSettings/GraphicsSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Examples/ProjectSettings/GraphicsSettings.asset
--------------------------------------------------------------------------------
/Examples/ProjectSettings/InputManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Examples/ProjectSettings/InputManager.asset
--------------------------------------------------------------------------------
/Examples/ProjectSettings/NavMeshAreas.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Examples/ProjectSettings/NavMeshAreas.asset
--------------------------------------------------------------------------------
/Examples/ProjectSettings/NetworkManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Examples/ProjectSettings/NetworkManager.asset
--------------------------------------------------------------------------------
/Examples/ProjectSettings/PackageManagerSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &1
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 61
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}
13 | m_Name:
14 | m_EditorClassIdentifier:
15 | m_EnablePreviewPackages: 0
16 | m_EnablePackageDependencies: 0
17 | m_AdvancedSettingsExpanded: 1
18 | m_ScopedRegistriesSettingsExpanded: 1
19 | oneTimeWarningShown: 0
20 | m_Registries:
21 | - m_Id: main
22 | m_Name:
23 | m_Url: https://packages.unity.com
24 | m_Scopes: []
25 | m_IsDefault: 1
26 | m_Capabilities: 7
27 | m_UserSelectedRegistryName:
28 | m_UserAddingNewScopedRegistry: 0
29 | m_RegistryInfoDraft:
30 | m_ErrorMessage:
31 | m_Original:
32 | m_Id:
33 | m_Name:
34 | m_Url:
35 | m_Scopes: []
36 | m_IsDefault: 0
37 | m_Capabilities: 0
38 | m_Modified: 0
39 | m_Name:
40 | m_Url:
41 | m_Scopes:
42 | -
43 | m_SelectedScopeIndex: 0
44 |
--------------------------------------------------------------------------------
/Examples/ProjectSettings/Physics2DSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Examples/ProjectSettings/Physics2DSettings.asset
--------------------------------------------------------------------------------
/Examples/ProjectSettings/PresetManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1386491679 &1
4 | PresetManager:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_DefaultPresets: {}
8 |
--------------------------------------------------------------------------------
/Examples/ProjectSettings/ProjectSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Examples/ProjectSettings/ProjectSettings.asset
--------------------------------------------------------------------------------
/Examples/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 2020.3.6f1
2 | m_EditorVersionWithRevision: 2020.3.6f1 (338bb68529b2)
3 |
--------------------------------------------------------------------------------
/Examples/ProjectSettings/QualitySettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Examples/ProjectSettings/QualitySettings.asset
--------------------------------------------------------------------------------
/Examples/ProjectSettings/TagManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Examples/ProjectSettings/TagManager.asset
--------------------------------------------------------------------------------
/Examples/ProjectSettings/TimeManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Examples/ProjectSettings/TimeManager.asset
--------------------------------------------------------------------------------
/Examples/ProjectSettings/UnityConnectSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Examples/ProjectSettings/UnityConnectSettings.asset
--------------------------------------------------------------------------------
/Examples/ProjectSettings/VFXManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!937362698 &1
4 | VFXManager:
5 | m_ObjectHideFlags: 0
6 | m_IndirectShader: {fileID: 0}
7 | m_CopyBufferShader: {fileID: 0}
8 | m_SortShader: {fileID: 0}
9 | m_StripUpdateShader: {fileID: 0}
10 | m_RenderPipeSettingsPath:
11 | m_FixedTimeStep: 0.016666668
12 | m_MaxDeltaTime: 0.05
13 | m_CompiledVersion: 0
14 | m_RuntimeVersion: 0
15 |
--------------------------------------------------------------------------------
/Examples/ProjectSettings/VersionControlSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!890905787 &1
4 | VersionControlSettings:
5 | m_ObjectHideFlags: 0
6 | m_Mode: Visible Meta Files
7 | m_CollabEditorSettings:
8 | inProgressEnabled: 1
9 |
--------------------------------------------------------------------------------
/Source/Example.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7e1a6d0add35e4a8d8e9fdafa49597dc
3 | folderAsset: yes
4 | timeCreated: 1499395085
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Source/Example/UGUIDemo.unity:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Source/Example/UGUIDemo.unity
--------------------------------------------------------------------------------
/Source/Example/UGUIDemo.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7f56260f8a8674203bf826c0311f17a9
3 | timeCreated: 1499835267
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Source/JsonBlocks.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 159ec504c47d4747ba03bc6f622e4f5d
3 | folderAsset: yes
4 | timeCreated: 1502599679
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Source/JsonBlocks/colour.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "type": "colour_picker",
4 | "message0": "%1",
5 | "args0": [
6 | {
7 | "type": "field_colour",
8 | "name": "COLOUR",
9 | "colour": "#ff0000"
10 | }
11 | ],
12 | "output": "Colour",
13 | "colour": "%{BKY_COLOUR_HUE}",
14 | "helpUrl": "%{BKY_COLOUR_PICKER_HELPURL}",
15 | "tooltip": "%{BKY_COLOUR_PICKER_TOOLTIP}",
16 | "extensions": ["parent_tooltip_when_inline"]
17 | },
18 |
19 | {
20 | "type": "colour_random",
21 | "message0": "%{BKY_COLOUR_RANDOM_TITLE}",
22 | "output": "Colour",
23 | "colour": "%{BKY_COLOUR_HUE}",
24 | "helpUrl": "%{BKY_COLOUR_RANDOM_HELPURL}",
25 | "tooltip": "%{BKY_COLOUR_RANDOM_TOOLTIP}"
26 | },
27 |
28 | {
29 | "type": "colour_rgb",
30 | "message0": "%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",
31 | "args0": [
32 | {
33 | "type": "input_value",
34 | "name": "RED",
35 | "check": "Number",
36 | "align": "RIGHT"
37 | },
38 | {
39 | "type": "input_value",
40 | "name": "GREEN",
41 | "check": "Number",
42 | "align": "RIGHT"
43 | },
44 | {
45 | "type": "input_value",
46 | "name": "BLUE",
47 | "check": "Number",
48 | "align": "RIGHT"
49 | }
50 | ],
51 | "output": "Colour",
52 | "colour": "%{BKY_COLOUR_HUE}",
53 | "helpUrl": "%{BKY_COLOUR_RGB_HELPURL}",
54 | "tooltip": "%{BKY_COLOUR_RGB_TOOLTIP}"
55 | },
56 |
57 | {
58 | "type": "colour_blend",
59 | "message0": "%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} %1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",
60 | "args0": [
61 | {
62 | "type": "input_value",
63 | "name": "COLOUR1",
64 | "check": "Colour",
65 | "align": "RIGHT"
66 | },
67 | {
68 | "type": "input_value",
69 | "name": "COLOUR2",
70 | "check": "Colour",
71 | "align": "RIGHT"
72 | },
73 | {
74 | "type": "input_value",
75 | "name": "RATIO",
76 | "check": "Number",
77 | "align": "RIGHT"
78 | }
79 | ],
80 | "output": "Colour",
81 | "colour": "%{BKY_COLOUR_HUE}",
82 | "helpUrl": "%{BKY_COLOUR_BLEND_HELPURL}",
83 | "tooltip": "%{BKY_COLOUR_BLEND_TOOLTIP}"
84 | }
85 | ]
86 |
--------------------------------------------------------------------------------
/Source/JsonBlocks/colour.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: de2eb98efd5db484d8cd9af05397d406
3 | timeCreated: 1502599981
4 | licenseType: Pro
5 | TextScriptImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Source/JsonBlocks/coroutine.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "type": "coroutine_wait_time",
4 | "message0": "%{BKY_COROUTINE_WAIT_TITLE} %1 %2",
5 | "args0": [
6 | {
7 | "type": "input_value",
8 | "name": "TIME",
9 | "check": "Number"
10 | },
11 | {
12 | "type": "field_dropdown",
13 | "name": "UNIT",
14 | "options": [
15 | ["%{BKY_TIME_UNIT_MILLISECOND}", "MILLISECOND"],
16 | ["%{BKY_TIME_UNIT_SECONDS}", "SECONDS"],
17 | ["%{BKY_TIME_UNIT_MINUTES}", "MINUTES"],
18 | ["%{BKY_TIME_UNIT_TOO_HIGH}", "TOOHIGH"]
19 | ]
20 | }
21 | ],
22 | "previousStatement": null,
23 | "nextStatement": null,
24 | "colour": "%{BKY_COROUTINE_HUE}"
25 | },
26 | {
27 | "type": "coroutine_wait_frame",
28 | "message0": "%{BKY_COROUTINE_WAIT_TITLE} %1 %{BKY_COROUTINE_FRAME}",
29 | "args0": [
30 | {
31 | "type": "input_value",
32 | "name": "TIME",
33 | "check": "Number"
34 | }
35 | ],
36 | "previousStatement": null,
37 | "nextStatement": null,
38 | "colour": "%{BKY_COROUTINE_HUE}"
39 | }
40 |
41 | ]
42 |
--------------------------------------------------------------------------------
/Source/JsonBlocks/coroutine.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 14b3c4755696d4d309a9c679f2260cc9
3 | timeCreated: 1502599981
4 | licenseType: Pro
5 | TextScriptImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Source/JsonBlocks/lists.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3bd2777606c104fe9b11adcc2909df57
3 | timeCreated: 1502599981
4 | licenseType: Pro
5 | TextScriptImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Source/JsonBlocks/logic.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8bc51b8dd772e480d893ec34fadf6b9c
3 | timeCreated: 1502599981
4 | licenseType: Pro
5 | TextScriptImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Source/JsonBlocks/loops.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e7bdd662f11a14d169ef05449a00fc69
3 | timeCreated: 1502599981
4 | licenseType: Pro
5 | TextScriptImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Source/JsonBlocks/math.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3e6180f677b424798b49ead1f46d58f2
3 | timeCreated: 1502599981
4 | licenseType: Pro
5 | TextScriptImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Source/JsonBlocks/procedures.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "type": "procedures_defnoreturn",
4 | "message0": "%{BKY_PROCEDURES_DEFNORETURN_TITLE} %1 %2",
5 | "args0": [
6 | {
7 | "type": "field_label",
8 | "name": "NAME",
9 | "text": "%{BKY_PROCEDURES_DEFRETURN_PROCEDURE}"
10 | },
11 | {
12 | "type": "field_label",
13 | "name": "PARAMS"
14 | }
15 | ],
16 | "mutator": "procedures_defnoreturn_mutator",
17 | "colour": "290",
18 | "tooltip": "Creates a function with no output.",
19 | "helpUrl": "https://en.wikipedia.org/wiki/Subroutine"
20 | },
21 | {
22 | "type": "procedures_defreturn",
23 | "message0": "%{BKY_PROCEDURES_DEFNORETURN_TITLE} %1 %2",
24 | "args0": [
25 | {
26 | "type": "field_label",
27 | "name": "NAME",
28 | "text": "%{BKY_PROCEDURES_DEFRETURN_PROCEDURE}"
29 | },
30 | {
31 | "type": "field_label",
32 | "name": "PARAMS"
33 | }
34 | ],
35 | "message1": "%{BKY_PROCEDURES_DEFRETURN_RETURN} %1",
36 | "args1": [
37 | {
38 | "type": "input_value",
39 | "name": "RETURN",
40 | "align": "RIGHT"
41 | }
42 | ],
43 | "mutator": "procedures_defreturn_mutator",
44 | "colour": "290",
45 | "tooltip": "Creates a function with an output.",
46 | "helpUrl": "https://en.wikipedia.org/wiki/Subroutine"
47 | },
48 | {
49 | "type": "procedures_callnoreturn",
50 | "message0": "%1 %2",
51 | "args0": [
52 | {
53 | "type": "field_label",
54 | "name": "NAME"
55 | },
56 | {
57 | "type": "input_dummy",
58 | "name": "TOPROW"
59 | }
60 | ],
61 | "mutator": "procedures_callnoreturn_mutator",
62 | "previousStatement": null,
63 | "nextStatement": null,
64 | "colour": "290",
65 | "helpUrl": "https://en.wikipedia.org/wiki/Subroutine"
66 | },
67 | {
68 | "type": "procedures_callreturn",
69 | "message0": "%1 %2",
70 | "args0": [
71 | {
72 | "type": "field_label",
73 | "name": "NAME"
74 | },
75 | {
76 | "type": "input_dummy",
77 | "name": "TOPROW"
78 | }
79 | ],
80 | "mutator": "procedures_callreturn_mutator",
81 | "output": null,
82 | "colour": "290",
83 | "helpUrl": "https://en.wikipedia.org/wiki/Subroutine"
84 | }
85 | ]
--------------------------------------------------------------------------------
/Source/JsonBlocks/procedures.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8ebb0af9c438947cc9330560c52ebbc4
3 | timeCreated: 1503485194
4 | licenseType: Pro
5 | TextScriptImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Source/JsonBlocks/text.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7881ae29bb5c648b5abcb1f131ba8c8f
3 | timeCreated: 1502599981
4 | licenseType: Pro
5 | TextScriptImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Source/JsonBlocks/variables.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "type": "variables_get",
4 | "message0": "%1",
5 | "args0": [
6 | {
7 | "type": "field_variable",
8 | "name": "VAR"
9 | }
10 | ],
11 | "output": null,
12 | "colour": "%{BKY_VARIABLES_HUE}",
13 | "helpUrl": "%{BKY_VARIABLES_GET_HELPURL}",
14 | "tooltip": "%{BKY_VARIABLES_GET_TOOLTIP}",
15 | "extensions": ["contextMenu_variableSetterGetter"]
16 | },
17 |
18 | {
19 | "type": "variables_set",
20 | "message0": "%{BKY_VARIABLES_SET}",
21 | "args0": [
22 | {
23 | "type": "field_variable",
24 | "name": "VAR"
25 | },
26 | {
27 | "type": "input_value",
28 | "name": "VALUE"
29 | }
30 | ],
31 | "previousStatement": null,
32 | "nextStatement": null,
33 | "colour": "%{BKY_VARIABLES_HUE}",
34 | "tooltip": "%{BKY_VARIABLES_SET_TOOLTIP}",
35 | "helpUrl": "%{BKY_VARIABLES_SET_HELPURL}",
36 | "extensions": ["contextMenu_variableSetterGetter"]
37 | },
38 |
39 | {
40 | "type": "variables_change",
41 | "message0": "%{BKY_VARIABLES_CHANGE_TITLE}",
42 | "args0": [
43 | {
44 | "type": "field_variable",
45 | "name": "VAR",
46 | "variable": "%{BKY_VARIABLES_CHANGE_TITLE_ITEM}"
47 | },
48 | {
49 | "type": "input_value",
50 | "name": "DELTA",
51 | "check": "Number"
52 | }
53 | ],
54 | "previousStatement": null,
55 | "nextStatement": null,
56 | "colour": "%{BKY_VARIABLES_HUE}",
57 | "helpUrl": "%{BKY_VARIABLES_CHANGE_HELPURL}",
58 | }
59 | ]
--------------------------------------------------------------------------------
/Source/JsonBlocks/variables.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d0e6cc79a30de40e6ab2a13928a03d85
3 | timeCreated: 1502599981
4 | licenseType: Pro
5 | TextScriptImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Source/Libs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a2e702f470afa4bc789a2f7e53c20c21
3 | folderAsset: yes
4 | timeCreated: 1510021213
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Source/Libs/JsonExtension.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json.Linq;
2 |
3 | public static class JsonExtension
4 | {
5 | ///
6 | /// Check if json data contains key specified
7 | ///
8 | public static bool JsonDataContainsKey(this JToken self, string key)
9 | {
10 | if (self == null) return false;
11 | if (!self.IsObject()) return false;
12 | return self[key] != null;
13 | }
14 |
15 | public static bool IsNullOrUndefined(this JToken self)
16 | {
17 | return self == null || self.Type == JTokenType.Null || self.Type == JTokenType.Undefined || self.Type == JTokenType.None;
18 | }
19 |
20 | public static bool IsBool(this JToken self)
21 | {
22 | return self != null && self.Type == JTokenType.Boolean;
23 | }
24 |
25 | public static bool IsInt(this JToken self)
26 | {
27 | return self != null && self.Type == JTokenType.Integer;
28 | }
29 |
30 | public static bool IsString(this JToken self)
31 | {
32 | return self != null && self.Type == JTokenType.String;
33 | }
34 |
35 | public static bool IsObject(this JToken self)
36 | {
37 | return self != null && self.Type == JTokenType.Object;
38 | }
39 |
40 | public static bool IsArray(this JToken self)
41 | {
42 | return self != null && self.Type == JTokenType.Array;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Source/Libs/JsonExtension.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 159b3f2b637ea4419838bae404ed59a3
3 | timeCreated: 1509982922
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Source/Libs/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imagicbell/ublockly/5f3b2c550ca79011567b081a5b8e98e06e7f9fdd/Source/Libs/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/Source/Libs/Newtonsoft.Json.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4d54f38b839e54690aba4dd36de18b91
3 | timeCreated: 1509980732
4 | licenseType: Pro
5 | PluginImporter:
6 | serializedVersion: 1
7 | iconMap: {}
8 | executionOrder: {}
9 | isPreloaded: 0
10 | isOverridable: 0
11 | platformData:
12 | Any:
13 | enabled: 1
14 | settings: {}
15 | Editor:
16 | enabled: 0
17 | settings:
18 | DefaultValueInitialized: true
19 | WindowsStoreApps:
20 | enabled: 0
21 | settings:
22 | CPU: AnyCPU
23 | userData:
24 | assetBundleName:
25 | assetBundleVariant:
26 |
--------------------------------------------------------------------------------
/Source/Script.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d8df82b6aa9c94a228dc72b25c4ec2b4
3 | folderAsset: yes
4 | timeCreated: 1499395031
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Source/Script/CodeDB.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d696352dd44f4ce790d5ab4c95e260d9
3 | folderAsset: yes
4 | timeCreated: 1503319004
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cc8aba8d92f44f23b0337c82ec9accc7
3 | timeCreated: 1503319020
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/CSharp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 03c1ba27475c4391ba3e47ac02778f8c
3 | timeCreated: 1500893320
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/CSharpGenerator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2f684091fa5c4b848f5ca689549e2562
3 | timeCreated: 1503319435
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/CSharpInterpreter.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b4ea42114d4a4ba9970fd3548899cc75
3 | timeCreated: 1501058140
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/CSharpRunner.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ac207c08426d4192aec1bd8b76c8acc0
3 | timeCreated: 1623317425
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Generators.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 22559fccb46d4a37a74532c73346e5c1
3 | timeCreated: 1503319367
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Generators/Coroutine_CSharp.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Functions for generating c# code for blocks.
4 |
5 | Copyright 2016 sophieml1989@gmail.com
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 |
19 | ****************************************************************************/
20 |
21 | namespace UBlockly
22 | {
23 | public partial class CSharpGenerator
24 | {
25 | [CodeGenerator(BlockType = "coroutine_wait_time")]
26 | private string Time_Wait(Block block)
27 | {
28 | string time = CSharp.Generator.ValueToCode(block, "TIME", CSharp.ORDER_NONE, "0");
29 | Number timeNumber = new Number(time);
30 | string op = block.GetFieldValue("UNIT");
31 | switch (op)
32 | {
33 | case "MILLISECOND":
34 | time = (timeNumber.Value * 0.001f).ToString();
35 | break;
36 | case "SECONDS":
37 | break;
38 | case "MINUTES":
39 | time = (timeNumber.Value * 60f).ToString();
40 | break;
41 | case "TOOHIGH":
42 | time = null;
43 | break;
44 | }
45 | if (string.IsNullOrEmpty(time)) return null;
46 | return string.Format("yield return new WaitForSeconds({0});\n", time);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Generators/Coroutine_CSharp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6d787e81cba84e239ed36ef5e69c09aa
3 | timeCreated: 1503395853
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Generators/Logic_CSharp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4e3d912294094311a771d03cac323da2
3 | timeCreated: 1503239486
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Generators/Loop_CSharp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 395b5354e14c45eeb6eff98a01b2737a
3 | timeCreated: 1503239498
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Generators/Math_CSharp.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Functions for generating c# code for blocks.
4 |
5 | Copyright 2016 sophieml1989@gmail.com
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 |
19 | ****************************************************************************/
20 |
21 | using System.Collections.Generic;
22 |
23 | namespace UBlockly
24 | {
25 | public partial class CSharpGenerator
26 | {
27 | [CodeGenerator(BlockType = "math_number")]
28 | private CodeStruct Math_Number(Block block)
29 | {
30 | string code = block.GetFieldValue("NUM");
31 | float num = float.Parse(code);
32 | int order = num < 0 ? CSharp.ORDER_UNARY : CSharp.ORDER_ATOMIC;
33 | return new CodeStruct(code, order);
34 | }
35 |
36 | [CodeGenerator(BlockType = "math_arithmetic")]
37 | private CodeStruct Math_Arithmetic(Block block)
38 | {
39 | Dictionary> operators = new Dictionary>
40 | {
41 | {"ADD", new KeyValuePair(" + ", CSharp.ORDER_ADDITIVE)},
42 | {"MINUS", new KeyValuePair(" - ", CSharp.ORDER_ADDITIVE)},
43 | {"MULTIPLY", new KeyValuePair(" * ", CSharp.ORDER_MULTIPLICATIVE)},
44 | {"DIVIDE", new KeyValuePair(" / ", CSharp.ORDER_MULTIPLICATIVE)},
45 | {"POWER", new KeyValuePair(null, CSharp.ORDER_COMMA)},
46 | };
47 |
48 | var pair = operators[block.GetFieldValue("OP")];
49 | string op = pair.Key;
50 | int order = pair.Value;
51 | string arg0 = CSharp.Generator.ValueToCode(block, "A", order, "0");
52 | string arg1 = CSharp.Generator.ValueToCode(block, "B", order, "0");
53 | string code;
54 | if (op == null)
55 | {
56 | //Power in c# requires a special case since it has no operator.
57 | code = string.Format("System.Math.Pow({0}, {1})", arg0, arg1);
58 | return new CodeStruct(code, CSharp.ORDER_EXPRESSION);
59 | }
60 | code = arg0 + op + arg1;
61 | return new CodeStruct(code, order);
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Generators/Math_CSharp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1abfd5b17d4242ba84e8ef388ae6586a
3 | timeCreated: 1503234631
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Generators/Text_CSharp.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Functions for generating c# code for blocks.
4 |
5 | Copyright 2016 sophieml1989@gmail.com
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 |
19 | ****************************************************************************/
20 |
21 | namespace UBlockly
22 | {
23 | public partial class CSharpGenerator
24 | {
25 | [CodeGenerator(BlockType = "text")]
26 | private CodeStruct Text(Block block)
27 | {
28 | string code = CSharp.Generator.Quote(block.GetFieldValue("TEXT"));
29 | return new CodeStruct(code, CSharp.ORDER_ATOMIC);
30 | }
31 |
32 | [CodeGenerator(BlockType = "text_print")]
33 | private string Text_Print(Block block)
34 | {
35 | string text = CSharp.Generator.ValueToCode(block, "TEXT", CSharp.ORDER_NONE, "\'\'");
36 | return string.Format("UnityEngine.Debug.Log({0});\n", text);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Generators/Text_CSharp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e8bcb79ef5d849e6a76df41e2c3add1e
3 | timeCreated: 1503230200
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Generators/Variables_CSharp.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Functions for generating c# code for blocks.
4 |
5 | Copyright 2016 sophieml1989@gmail.com
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 |
19 | ****************************************************************************/
20 |
21 | namespace UBlockly
22 | {
23 | public partial class CSharpGenerator
24 | {
25 | [CodeGenerator(BlockType = "variables_get")]
26 | private CodeStruct Variables_Get(Block block)
27 | {
28 | string code = CSharp.VariableNames.GetName(block.GetFieldValue("VAR"), Define.VARIABLE_CATEGORY_NAME);
29 | return new CodeStruct(code, CSharp.ORDER_ATOMIC);
30 | }
31 |
32 | [CodeGenerator(BlockType = "variables_set")]
33 | private string Variables_Set(Block block)
34 | {
35 | string varName = CSharp.VariableNames.GetName(block.GetFieldValue("VAR"), Define.VARIABLE_CATEGORY_NAME);
36 | string arg = CSharp.Generator.ValueToCode(block, "VALUE", CSharp.ORDER_NONE, "0");
37 | return varName + " = " + arg + ";\n";
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Generators/Variables_CSharp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 63021a8a106340f98c6622d3ef835e47
3 | timeCreated: 1500893501
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Interpreters.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9bf766492ad24b6ab45847a47549e5da
3 | timeCreated: 1503319403
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Interpreters/Coroutine_CSharp.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Functions for interpreting c# code for blocks.
4 |
5 | Copyright 2016 sophieml1989@gmail.com
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 |
19 | ****************************************************************************/
20 |
21 |
22 | using System.Collections;
23 | using UnityEngine;
24 |
25 | namespace UBlockly
26 | {
27 | [CodeInterpreter(BlockType = "coroutine_wait_time")]
28 | public class Coroutine_WaitTime_Cmdtor : EnumeratorCmdtor
29 | {
30 | protected override IEnumerator Execute(Block block)
31 | {
32 | Debug.Log(">>>>>> block wait_time start: " + Time.time);
33 |
34 | CmdEnumerator ctor = CSharp.Interpreter.ValueReturn(block, "TIME", new DataStruct(0));
35 | yield return ctor;
36 | DataStruct time = ctor.Data;
37 |
38 | string unit = block.GetFieldValue("UNIT");
39 | switch (unit)
40 | {
41 | case "MILLISECOND":
42 | yield return new WaitForSeconds(time.NumberValue.Value * 0.001f);
43 | break;
44 | case "SECONDS":
45 | yield return new WaitForSeconds(time.NumberValue.Value);
46 | break;
47 | case "MINUTES":
48 | yield return new WaitForSeconds(time.NumberValue.Value * 60f);
49 | break;
50 | case "TOOHIGH":
51 | Debug.Log("wait time too long");
52 | break;
53 | }
54 | Debug.Log(">>>>>> block wait_time end: " + Time.time);
55 | }
56 | }
57 |
58 | [CodeInterpreter(BlockType = "coroutine_wait_frame")]
59 | public class Coroutine_WaitFrame_Cmdtor : EnumeratorCmdtor
60 | {
61 | protected override IEnumerator Execute(Block block)
62 | {
63 | Debug.Log(">>>>>> block wait_frame start: " + Time.time);
64 |
65 | CmdEnumerator ctor = CSharp.Interpreter.ValueReturn(block, "TIME", new DataStruct(0));
66 | yield return ctor;
67 | DataStruct time = ctor.Data;
68 |
69 | for (int i = 0; i < time.NumberValue.Value; i++)
70 | {
71 | yield return null;
72 | }
73 |
74 | Debug.Log(">>>>>> block wait_frame end: " + Time.time);
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Interpreters/Coroutine_CSharp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 33f54ed805584e698811aa132b14b000
3 | timeCreated: 1503463061
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Interpreters/List_CSharp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1f3e8921dbf444d4b050fd86d1e1396f
3 | timeCreated: 1503239546
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Interpreters/Logic_CSharp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5d55d0723d7144d1b40e499ab44e2d17
3 | timeCreated: 1503239564
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Interpreters/Loop_CSharp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 50542d6f2f20429388882b786114ef6c
3 | timeCreated: 1503239575
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Interpreters/Math_CSharp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a7393278a57b45698b8d80e28007c388
3 | timeCreated: 1503239398
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Interpreters/Procedure_CSharp.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Functions for interpreting c# code for blocks.
4 |
5 | Copyright 2016 sophieml1989@gmail.com
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 |
19 | ****************************************************************************/
20 |
21 |
22 | using System.Collections;
23 |
24 | namespace UBlockly
25 | {
26 | [CodeInterpreter(BlockType = "procedures_callreturn")]
27 | public class Procedure_CallReturn_Cmdtor : EnumeratorCmdtor
28 | {
29 | protected override IEnumerator Execute(Block block)
30 | {
31 | string procedureName = block.GetFieldValue("NAME");
32 | Block defBlock = block.Workspace.ProcedureDB.GetDefinitionBlock(procedureName);
33 | yield return CSharp.Interpreter.StatementRun(defBlock, "STACK");
34 |
35 | CmdEnumerator ctor = CSharp.Interpreter.ValueReturn(defBlock, "RETURN");
36 | yield return ctor;
37 | ReturnData(ctor.Data);
38 | }
39 | }
40 |
41 | [CodeInterpreter(BlockType = "procedures_callnoreturn")]
42 | public class Procedure_CallNoReturn_Cmdtor : EnumeratorCmdtor
43 | {
44 | protected override IEnumerator Execute(Block block)
45 | {
46 | string procedureName = block.GetFieldValue("NAME");
47 | Block defBlock = block.Workspace.ProcedureDB.GetDefinitionBlock(procedureName);
48 | yield return CSharp.Interpreter.StatementRun(defBlock, "STACK");
49 | }
50 | }
51 |
52 | [CodeInterpreter(BlockType = "procedures_ifreturn")]
53 | public class Proceudre_IfReturn_Cmdtor : EnumeratorCmdtor
54 | {
55 | protected override IEnumerator Execute(Block block)
56 | {
57 | yield return 0;
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Interpreters/Procedure_CSharp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 46d1b42e3fee4e0e8996d32f0c86cf66
3 | timeCreated: 1508296076
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Interpreters/Text_CSharp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f715cff0d9da4eaea13bb59e2501c4ee
3 | timeCreated: 1503234092
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Interpreters/Variables_CSharp.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Functions for interpreting c# code for blocks.
4 |
5 | Copyright 2016 sophieml1989@gmail.com
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 |
19 | ****************************************************************************/
20 |
21 |
22 | using System.Collections;
23 |
24 | namespace UBlockly
25 | {
26 | [CodeInterpreter(BlockType = "variables_get")]
27 | public class Variables_Get_Cmdtor : ValueCmdtor
28 | {
29 | protected override DataStruct Execute(Block block)
30 | {
31 | string varName = CSharp.VariableNames.GetName(block.GetFieldValue("VAR"), Define.VARIABLE_CATEGORY_NAME);
32 | return CSharp.VariableDatas.GetData(varName);
33 | }
34 | }
35 |
36 | [CodeInterpreter(BlockType = "variables_set")]
37 | public class Variables_Set_Cmdtor : EnumeratorCmdtor
38 | {
39 | protected override IEnumerator Execute(Block block)
40 | {
41 | string varName = CSharp.VariableNames.GetName(block.GetFieldValue("VAR"), Define.VARIABLE_CATEGORY_NAME);
42 | CmdEnumerator ctor = CSharp.Interpreter.ValueReturn(block, "VALUE");
43 | yield return ctor;
44 | CSharp.VariableDatas.SetData(varName, ctor.Data);
45 | }
46 | }
47 |
48 | [CodeInterpreter(BlockType = "variables_change")]
49 | public class Math_Change_Cmdtor : EnumeratorCmdtor
50 | {
51 | protected override IEnumerator Execute(Block block)
52 | {
53 | string tmp = block.GetFieldValue("VAR");
54 |
55 | CmdEnumerator ctor = CSharp.Interpreter.ValueReturn(block, "DELTA", new DataStruct(0));
56 | yield return ctor;
57 | DataStruct arg1 = ctor.Data;
58 |
59 | Number result = CSharp.VariableDatas.GetData(tmp).NumberValue + arg1.NumberValue;
60 | CSharp.VariableDatas.SetData(tmp, new DataStruct(result));
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Source/Script/CodeDB/CSharp/Interpreters/Variables_CSharp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e2982fd5c1c141ea98e4388f6338eedd
3 | timeCreated: 1501059331
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e3203af6520840b19553868d9ea552bc
3 | timeCreated: 1503319029
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/Generators.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0144e496f3304c5fba994434f6fea99a
3 | timeCreated: 1503319051
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/Generators/Colour_Lua.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7b28edbe72464c5786913251e375557f
3 | timeCreated: 1503039126
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/Generators/List_Lua.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2ac3b8bb383f4a46b83ca2cb02f0bac4
3 | timeCreated: 1503027097
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/Generators/Logic_Lua.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ae237a1d1c4d4366be7c3b04f1f9a51d
3 | timeCreated: 1502683329
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/Generators/Loop_Lua.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4b21eef1f7574120bed22688f48156d6
3 | timeCreated: 1502954268
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/Generators/Math_Lua.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 147559e9a8a7421e9b8cbb4263011ed0
3 | timeCreated: 1502942443
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/Generators/Procedure_Lua.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8e0aa44ba0bc4f5f8b01c2d0ecd5b8ae
3 | timeCreated: 1503485792
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/Generators/Text_Lua.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6b897a383b7f45318d6322cb9f1205ba
3 | timeCreated: 1502695105
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/Generators/Variables_Lua.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Functions for generating lua code for blocks.
4 |
5 | Copyright 2016 sophieml1989@gmail.com
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 |
19 | ****************************************************************************/
20 |
21 | using System;
22 |
23 | namespace UBlockly
24 | {
25 | public partial class LuaGenerator
26 | {
27 | [CodeGenerator(BlockType = "variables_get")]
28 | private CodeStruct Variables_Get(Block block)
29 | {
30 | string code = Lua.VariableNames.GetName(block.GetFieldValue("VAR"), Define.VARIABLE_CATEGORY_NAME);
31 | return new CodeStruct(code, Lua.ORDER_ATOMIC);
32 | }
33 |
34 | [CodeGenerator(BlockType = "variables_set")]
35 | private string Variables_Set(Block block)
36 | {
37 | var arg = Lua.Generator.ValueToCode(block, "VALUE", Lua.ORDER_NONE, "0");
38 | var varName = Lua.VariableNames.GetName(block.GetFieldValue("VAR"), Define.VARIABLE_CATEGORY_NAME);
39 | return varName + " = " + arg + "\n";
40 | }
41 |
42 | [CodeGenerator(BlockType = "variables_change")]
43 | private string Math_Change(Block block)
44 | {
45 | string varName = Lua.VariableNames.GetName(block.GetFieldValue("VAR"), Variables.NAME_TYPE);
46 | string arg = Lua.Generator.ValueToCode(block, "DELTA", Lua.ORDER_ADDITIVE, "0");
47 | return string.Format("{0} = {0} + {1}\n", varName, arg);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/Generators/Variables_Lua.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 89f761904b6e43bea272bf7f4fcd50e5
3 | timeCreated: 1500893597
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/Lua.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2e4bc0e0083445f99fe5b4052d8ceeb1
3 | timeCreated: 1499913905
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/LuaGenerator.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Helper functions for generating lua for blocks.
4 |
5 | Copyright 2016 sophieml1989@gmail.com
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 |
19 | ****************************************************************************/
20 |
21 |
22 | using System.Text;
23 |
24 | namespace UBlockly
25 | {
26 | public partial class LuaGenerator : Generator
27 | {
28 | public override CodeName Name
29 | {
30 | get { return CodeName.Lua; }
31 | }
32 |
33 | public LuaGenerator(Names variableNames) : base(variableNames)
34 | {
35 | }
36 |
37 | protected override void Init(Workspace workspace)
38 | {
39 | mFuncMap.Clear();
40 | mVariableNames.Reset();
41 | }
42 |
43 | protected override string Finish(string code)
44 | {
45 | StringBuilder sb = new StringBuilder();
46 | foreach (var pair in mFuncMap.Values)
47 | sb.Append(pair.Value + "\n\n");
48 |
49 | // Clean up temporary data.
50 | mFuncMap.Clear();
51 | mVariableNames.Reset();
52 |
53 | return sb + code;
54 | }
55 |
56 | protected override string Scrub(Block block, string code)
57 | {
58 | //todo: add comment
59 | return base.Scrub(block, code);
60 | }
61 |
62 | protected override string ScrubNakedValue(string code)
63 | {
64 | return "local _ = " + code + "\n";
65 | }
66 |
67 | ///
68 | /// Encode a string as a properly escaped Lua string, complete with quotes.
69 | ///
70 | public string Quote(string text)
71 | {
72 | if (string.IsNullOrEmpty(text))
73 | return "\'\'";
74 |
75 | string newtext = text.Replace("\\", "\\\\").Replace("\n", "\\\n").Replace("'", "\\\'");
76 | return "\'" + newtext + "\'";
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/LuaGenerator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bc6d6518c2f249d6a18bfc6defdf2ee7
3 | timeCreated: 1503319123
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/LuaInterpreter.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | Copyright 2016 sophieml1989@gmail.com
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 |
16 | ****************************************************************************/
17 |
18 | #if ULUA_SUPPORT
19 | using LuaInterface;
20 | #endif
21 |
22 | namespace UBlockly
23 | {
24 | public partial class LuaInterpreter : Interpreter
25 | {
26 | public override CodeName Name
27 | {
28 | get { return CodeName.Lua; }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/LuaInterpreter.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 331e14a552574dac9e84656a90d59edf
3 | timeCreated: 1501057129
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/LuaRunner.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | Copyright 2021 sophieml1989@gmail.com
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 |
16 | ****************************************************************************/
17 |
18 | namespace UBlockly
19 | {
20 | public class LuaRunner : Runner
21 | {
22 | public override void Run(Workspace workspace)
23 | {
24 | string code = Lua.Generator.WorkspaceToCode(workspace);
25 |
26 | #if ULUA_SUPPORT
27 | LuaState lua = new LuaState();
28 | lua.Start();
29 | lua.DoString(code);
30 | lua = null;
31 | #endif
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/Source/Script/CodeDB/Lua/LuaRunner.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3ed099b55f3545e4aead2bbeb982ccba
3 | timeCreated: 1623317814
--------------------------------------------------------------------------------
/Source/Script/Core.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b91ce0df37b84f51aba760dd7466755c
3 | timeCreated: 1499856287
--------------------------------------------------------------------------------
/Source/Script/Core/Block.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 04fbcbc18ee34aa3be5ed8bbff139e84
3 | folderAsset: yes
4 | timeCreated: 1510672886
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Source/Script/Core/Block/Block.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f03d0bb3f81546b1bb2ab71b55c306db
3 | timeCreated: 1499856901
--------------------------------------------------------------------------------
/Source/Script/Core/Block/BlockDefinition.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b0b82b319de040eda147bef9c988f58a
3 | timeCreated: 1502790630
--------------------------------------------------------------------------------
/Source/Script/Core/Block/BlockFactory.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 21cc3500561643c3974f6f4aae06a276
3 | timeCreated: 1502850431
--------------------------------------------------------------------------------
/Source/Script/Core/Blockly.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Copyright 2016 sophieml1989@gmail.com
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | ****************************************************************************/
18 |
19 | using System;
20 | using System.Collections;
21 | using System.Collections.Generic;
22 | using Newtonsoft.Json.Linq;
23 | using UnityEngine;
24 |
25 | namespace UBlockly
26 | {
27 | public class Blockly
28 | {
29 | ///
30 | /// Initialize blockly model. Called very first when start blockly
31 | ///
32 | public static void Init()
33 | {
34 | BlockResMgr.Get().LoadI18n();
35 | BlockResMgr.Get().LoadJsonDefinitions();
36 | }
37 |
38 | ///
39 | /// clear all blocks loaded
40 | ///
41 | public static void Dispose()
42 | {
43 | BlockFactory.Instance.Clear();
44 | I18n.Dispose();
45 | }
46 |
47 | ///
48 | /// Define blocks from an array of JSON block definitions, as might be generated
49 | /// by the Blockly Developer Tools.
50 | ///
51 | ///
52 | [Obsolete("Only used for test case. Use BlockFactory.Instance.AddJsonDefinitions instead.")]
53 | public static void DefineBlocksWithJsonArray(JArray jsonArray)
54 | {
55 | BlockFactory.Instance.AddJsonDefinitions(jsonArray.ToString());
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Source/Script/Core/Blockly.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 84c1a8b4acd33422a84278c24b4fbd3d
3 | timeCreated: 1499843516
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Source/Script/Core/Code.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9141a526ccb047dfbf99a3b9d8a53382
3 | folderAsset: yes
4 | timeCreated: 1510672886
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Source/Script/Core/Code/CmdEnumerator.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Copyright 2016 sophieml1989@gmail.com
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | ****************************************************************************/
18 |
19 | using System.Collections;
20 |
21 | namespace UBlockly
22 | {
23 | ///
24 | /// IEnumerator wrapper for running Cmdtor, block code
25 | ///
26 | public class CmdEnumerator : IEnumerator
27 | {
28 | private readonly Block mBlock;
29 | private readonly Cmdtor mCmdtor;
30 | private IEnumerator mItor;
31 |
32 | public Block Block
33 | {
34 | get { return mBlock; }
35 | }
36 |
37 | public Cmdtor Cmdtor
38 | {
39 | get { return mCmdtor; }
40 | }
41 |
42 | public DataStruct Data
43 | {
44 | get { return mCmdtor.Data; }
45 | }
46 |
47 | public CmdEnumerator(Block block)
48 | {
49 | mBlock = block;
50 | mCmdtor = CSharp.Interpreter.GetBlockInterpreter(block);
51 | mItor = mCmdtor.Run(block);
52 | }
53 |
54 | public bool MoveNext()
55 | {
56 | return mItor.MoveNext();
57 | }
58 |
59 | public void Reset()
60 | {
61 | mItor = null;
62 | }
63 |
64 | public object Current
65 | {
66 | get { return mItor.Current; }
67 | }
68 |
69 | ///
70 | /// get the next block's running code, connected with previous - next connection
71 | ///
72 | public CmdEnumerator GetNextCmd()
73 | {
74 | var nextblock = mBlock.NextBlock;
75 | if (nextblock == null || nextblock.Disabled)
76 | return null;
77 |
78 | //parent loop was break or continue, move out.
79 | if (LoopCmdtor.SkipRunByControlFlow(nextblock))
80 | return null;
81 |
82 | return new CmdEnumerator(nextblock);
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/Source/Script/Core/Code/CmdEnumerator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0f287faba07b41a291764940af3db8a5
3 | timeCreated: 1623208411
--------------------------------------------------------------------------------
/Source/Script/Core/Code/CmdRunner.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e8cd13be43e9414185dcd5a1dab9025d
3 | timeCreated: 1623160475
--------------------------------------------------------------------------------
/Source/Script/Core/Code/Cmdtor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6cc13d4d0bac4d5884cbc0881b50ec4a
3 | timeCreated: 1509443217
--------------------------------------------------------------------------------
/Source/Script/Core/Code/CodeDefs.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Collections for some definitions for code generations and interpreting
4 |
5 | Copyright 2016 sophieml1989@gmail.com
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 |
19 | ****************************************************************************/
20 |
21 | using System;
22 | using System.ComponentModel;
23 |
24 | namespace UBlockly
25 | {
26 | public enum CodeName
27 | {
28 | CSharp,
29 | Lua,
30 | }
31 |
32 | public enum ControlFlowType
33 | {
34 | None,
35 | Break,
36 | Continue,
37 | }
38 |
39 | [AttributeUsage(AttributeTargets.Method, Inherited = false)]
40 | public sealed class CodeGeneratorAttribute : Attribute
41 | {
42 | [Description("method for generating block code string")]
43 | public CodeGeneratorAttribute() {}
44 | public string BlockType { get; set; }
45 | }
46 |
47 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
48 | public sealed class CodeInterpreterAttribute : Attribute
49 | {
50 | [Description("method for interpreting to implement block code")]
51 | public CodeInterpreterAttribute() {}
52 | public string BlockType { get; set; }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Source/Script/Core/Code/CodeDefs.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3063580b013047029517cd5ca9d7a2e3
3 | timeCreated: 1501056007
--------------------------------------------------------------------------------
/Source/Script/Core/Code/Datas.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ad7e5d9c1b3747a1b091153d1f7b21e1
3 | timeCreated: 1503306429
--------------------------------------------------------------------------------
/Source/Script/Core/Code/Generator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 806758f7db514f699790e02e653ab0de
3 | timeCreated: 1499856297
--------------------------------------------------------------------------------
/Source/Script/Core/Code/Interpreter.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Utility functions for interpreting Blockly code to implementations
4 |
5 | Copyright 2016 sophieml1989@gmail.com
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 |
19 | ****************************************************************************/
20 |
21 | using System;
22 | using System.Collections.Generic;
23 | using System.Reflection;
24 |
25 | namespace UBlockly
26 | {
27 | public abstract class Interpreter
28 | {
29 | public abstract CodeName Name { get; }
30 |
31 | ///
32 | /// instances for interpreting code
33 | ///
34 | protected Dictionary mCmdMap;
35 |
36 | protected Interpreter()
37 | {
38 | InitCodeDB();
39 | }
40 |
41 | ///
42 | /// collect all code generation/interpretion methods
43 | ///
44 | protected void InitCodeDB()
45 | {
46 | mCmdMap = new Dictionary();
47 | Assembly assem = Assembly.GetAssembly(this.GetType());
48 | foreach (Type type in assem.GetTypes())
49 | {
50 | if (type.IsSubclassOf(typeof(Cmdtor)))
51 | {
52 | var attrs = type.GetCustomAttributes(typeof(CodeInterpreterAttribute), false);
53 | if (attrs.Length > 0)
54 | {
55 | mCmdMap[((CodeInterpreterAttribute) attrs[0]).BlockType] = Activator.CreateInstance(type) as Cmdtor;
56 | }
57 | }
58 | }
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/Source/Script/Core/Code/Interpreter.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 09ca3f53b93546cd9a01d9a89f486c11
3 | timeCreated: 1501056174
--------------------------------------------------------------------------------
/Source/Script/Core/Code/Names.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e37b6db876b44387a98d7c69f5d50198
3 | timeCreated: 1499914268
--------------------------------------------------------------------------------
/Source/Script/Core/Code/Runner.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b26d51eeeae948978a51e5c2a7bd0ab0
3 | timeCreated: 1623317046
--------------------------------------------------------------------------------
/Source/Script/Core/Connection.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3219e017e19c42c6b898daa90e962faf
3 | folderAsset: yes
4 | timeCreated: 1510672886
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Source/Script/Core/Connection/Connection.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4f49c22831a64e4b9324bf35fd4cf143
3 | timeCreated: 1499923953
--------------------------------------------------------------------------------
/Source/Script/Core/Connection/ConnectionDB.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 65e74311394d475387907698b63d9c0e
3 | timeCreated: 1500633328
--------------------------------------------------------------------------------
/Source/Script/Core/CustomDefine.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5d870a56415547579d73109e911ba81e
3 | folderAsset: yes
4 | timeCreated: 1510672886
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Source/Script/Core/CustomDefine/Number.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: df7956ad627b4eba8c12637cf4913c83
3 | timeCreated: 1502029789
--------------------------------------------------------------------------------
/Source/Script/Core/CustomDefine/ObservePattern.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Copyright 2016 sophieml1989@gmail.com
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | ****************************************************************************/
18 |
19 | using System.Collections.Generic;
20 |
21 | namespace UBlockly
22 | {
23 | ///
24 | /// Customed Observable/Observer pattern
25 | ///
26 | public interface IObserver
27 | {
28 | void OnUpdated(object subject, TArgs args);
29 | }
30 |
31 | ///
32 | /// Customed Observable/Observer pattern
33 | ///
34 | public abstract class Observable
35 | {
36 | private readonly List> mObservers = new List>();
37 |
38 | public void AddObserver(IObserver observer)
39 | {
40 | if (!mObservers.Contains(observer))
41 | mObservers.Add(observer);
42 | }
43 |
44 | public void RemoveObserver(IObserver observer)
45 | {
46 | mObservers.Remove(observer);
47 | }
48 |
49 | public void FireUpdate(TArgs args)
50 | {
51 | for (int i = mObservers.Count - 1; i >= 0; i--)
52 | {
53 | mObservers[i].OnUpdated(this, args);
54 | }
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/Source/Script/Core/CustomDefine/ObservePattern.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6062d1aeb798483a8883c9dfff8cab79
3 | timeCreated: 1505116233
--------------------------------------------------------------------------------
/Source/Script/Core/CustomDefine/Vector.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Copyright 2016 sophieml1989@gmail.com
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | ****************************************************************************/
18 |
19 | namespace UBlockly
20 | {
21 | public struct Vector2
22 | {
23 | public T x;
24 | public T y;
25 |
26 | public Vector2(T x, T y)
27 | {
28 | this.x = x;
29 | this.y = y;
30 | }
31 | }
32 |
33 | public struct Vector3
34 | {
35 | public T x;
36 | public T y;
37 | public T z;
38 |
39 | public Vector3(T x, T y, T z)
40 | {
41 | this.x = x;
42 | this.y = y;
43 | this.z = z;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Source/Script/Core/CustomDefine/Vector.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 129a205267794fcab14274f46c955282
3 | timeCreated: 1502355534
--------------------------------------------------------------------------------
/Source/Script/Core/Define.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6bb0a709d4c64965bc9efbcda0775860
3 | timeCreated: 1499923959
--------------------------------------------------------------------------------
/Source/Script/Core/Field.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8d56f8bd05bb496e9079e9ad7f3f6725
3 | folderAsset: yes
4 | timeCreated: 1510672886
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Source/Script/Core/Field/Field.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 041abba516954937b9af6e04d52adbbb
3 | timeCreated: 1499924003
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldAngle.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c9f4296a9cd1473c8563257af403d948
3 | timeCreated: 1499924015
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldCheckbox.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Copyright 2016 sophieml1989@gmail.com
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | ****************************************************************************/
18 |
19 | using Newtonsoft.Json.Linq;
20 |
21 | namespace UBlockly
22 | {
23 | public sealed class FieldCheckbox : Field
24 | {
25 | [FieldCreator(FieldType = "field_checkbox")]
26 | private static FieldCheckbox CreateFromJson(JObject json)
27 | {
28 | string fieldName = json["name"].IsString() ? json["name"].ToString() : "FIELDNAME_DEFAULT";
29 | return new FieldCheckbox(fieldName, json["checked"] != null && json["checked"].ToString().ToUpper() == "TRUE" ? "TRUE" : "FALSE");
30 | }
31 |
32 | ///
33 | /// Class for a checkbox field.
34 | ///
35 | /// The unique name of the field, usually defined in json block.
36 | /// The initial state of the field ('TRUE' or 'FALSE').
37 | public FieldCheckbox(string fieldName, string state) : base(fieldName)
38 | {
39 | this.SetValue(state);
40 | }
41 |
42 | public override void SetValue(string newValue)
43 | {
44 | newValue = newValue.ToUpper();
45 | if (newValue != "TRUE" && newValue != "FALSE")
46 | return;
47 |
48 | base.SetValue(newValue);
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldCheckbox.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e50fa24d24cc4e74920b9b6e84bfceb0
3 | timeCreated: 1499924031
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldColour.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0754b3aba8a44f07906d53a693c5df94
3 | timeCreated: 1499924044
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldDate.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Copyright 2016 sophieml1989@gmail.com
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | ****************************************************************************/
18 |
19 | using System;
20 | using System.Globalization;
21 | using Newtonsoft.Json.Linq;
22 |
23 | namespace UBlockly
24 | {
25 | public sealed class FieldDate : Field
26 | {
27 | [FieldCreator(FieldType = "field_date")]
28 | private static FieldDate CreateFromJson(JObject json)
29 | {
30 | string fieldName = json["name"].IsString() ? json["name"].ToString() : "FIELDNAME_DEFAULT";
31 | string dateStr = json.JsonDataContainsKey("date") ? json["date"].ToString() : null;
32 | return new FieldDate(fieldName, dateStr);
33 | }
34 |
35 | private const string DATE_FORMAT = "yyyy-MM-dd";
36 |
37 | private DateTime mDate;
38 | public DateTime Date { get { return mDate; } }
39 |
40 | public FieldDate(string fieldName, string dateStr) : base(fieldName)
41 | {
42 | if (!DateTime.TryParseExact(dateStr, DATE_FORMAT, null, DateTimeStyles.None, out mDate))
43 | throw new Exception(
44 | String.Format("FieldDate: can\'t parse date string {0} to DateTime. Correct format is {1}.", dateStr, DATE_FORMAT));
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldDate.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7a32eff7f6314cbf92bc32a5840495bc
3 | timeCreated: 1511925613
4 | MonoImporter:
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldDropdown.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 803d8a9b4d33411a8bcbfda2b1ad57ec
3 | timeCreated: 1499924061
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldFactory.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9c89e513d2b04299940521a237bcdda2
3 | timeCreated: 1503559246
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldImage.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Copyright 2016 sophieml1989@gmail.com
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | ****************************************************************************/
18 |
19 | using Newtonsoft.Json.Linq;
20 |
21 | namespace UBlockly
22 | {
23 | public sealed class FieldImage : Field
24 | {
25 | [FieldCreator(FieldType = "field_image")]
26 | private static FieldImage CreateFromJson(JObject json)
27 | {
28 | string fieldName = json["name"].IsString() ? json["name"].ToString() : "FIELDNAME_DEFAULT";
29 | string imageSrc = json.JsonDataContainsKey("src") ? json["src"].ToString() : null;
30 | Number width = json.JsonDataContainsKey("width") ? new Number(json["width"].ToString()) : Number.NaN;
31 | Number height = json.JsonDataContainsKey("height") ? new Number(json["height"].ToString()) : Number.NaN;
32 | string alt = json.JsonDataContainsKey("alt") ? json["alt"].ToString() : null;
33 | return new FieldImage(fieldName, imageSrc, new Vector2((int) width.Value, (int) height.Value), alt);
34 | }
35 |
36 | private Vector2 mSize;
37 | public Vector2 Size { get { return mSize; } }
38 |
39 | public FieldImage(string fieldName, string imageSrc, Vector2 imageSize, string optAlt = null) : base(fieldName)
40 | {
41 | this.mText = !string.IsNullOrEmpty(optAlt) ? optAlt : "";
42 | if (string.IsNullOrEmpty(imageSrc))
43 | imageSrc = "fieldimage_default";
44 | this.SetValue(imageSrc);
45 |
46 | mSize = imageSize;
47 | if (mSize.x <= 0) mSize.x = Define.FIELD_IMAGE_WIDTH_DEFAULT;
48 | if (mSize.y <= 0) mSize.y = Define.FIELD_IMAGE_HEIGHT_DEFAULT;
49 |
50 | IsImage = true;
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldImage.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 49027fc67bad4b2ca94870202de3f507
3 | timeCreated: 1511923035
4 | MonoImporter:
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldLabel.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Copyright 2016 sophieml1989@gmail.com
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | ****************************************************************************/
18 |
19 | using Newtonsoft.Json.Linq;
20 | using UnityEngine;
21 |
22 | namespace UBlockly
23 | {
24 | public sealed class FieldLabel : Field
25 | {
26 | [FieldCreator(FieldType = "field_label")]
27 | private static FieldLabel CreateFromJson(JObject json)
28 | {
29 | string fieldName = json["name"].IsString() ? json["name"].ToString() : "FIELDNAME_DEFAULT";
30 | var text = json["text"].IsString() ? Utils.ReplaceMessageReferences(json["text"].ToString()) : "";
31 | return new FieldLabel(fieldName, text);
32 | }
33 |
34 | ///
35 | /// Class for a non-editable field.
36 | ///
37 | /// The unique name of the field, usually defined in json block.
38 | /// The initial content of the field
39 | public FieldLabel(string fieldName, string text) : base(fieldName)
40 | {
41 | this.SetValue(text);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldLabel.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7542fa51fa5043babf58a643de3c44d0
3 | timeCreated: 1499924076
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldNumber.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a629f4c499f64f0eb1048faec56311bd
3 | timeCreated: 1499924091
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldTextInput.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Copyright 2016 sophieml1989@gmail.com
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | ****************************************************************************/
18 |
19 | using Newtonsoft.Json.Linq;
20 |
21 | namespace UBlockly
22 | {
23 | public class FieldTextInput : Field
24 | {
25 | [FieldCreator(FieldType = "field_input")]
26 | private static FieldTextInput CreateFromJson(JObject json)
27 | {
28 | string fieldName = json["name"].IsString() ? json["name"].ToString() : "FIELDNAME_DEFAULT";
29 | var text = json["text"].IsString() ? Utils.ReplaceMessageReferences(json["text"].ToString()) : "";
30 | return new FieldTextInput(fieldName, text);
31 | }
32 |
33 | ///
34 | /// Empty constructor for inheritance use
35 | ///
36 | protected FieldTextInput(string fieldName) : base(fieldName) {}
37 |
38 | ///
39 | /// Class for an editable text field.
40 | ///
41 | /// The unique name of the field, usually defined in json block.
42 | /// The default text in the field
43 | public FieldTextInput(string fieldName, string text) : base(fieldName)
44 | {
45 | this.SetValue(text);
46 | }
47 |
48 | public override void SetValue(string newValue)
49 | {
50 | if (string.IsNullOrEmpty(newValue))
51 | return;
52 |
53 | if (SourceBlock != null)
54 | {
55 | string validated = CallValidator(newValue);
56 | if (validated != null)
57 | newValue = validated;
58 | }
59 |
60 | base.SetValue(newValue);
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldTextInput.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 52b442e2e02440229e4af26c839ab781
3 | timeCreated: 1499924103
--------------------------------------------------------------------------------
/Source/Script/Core/Field/FieldVariable.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2b35ab14b6e6467fbaa405b4f6b0c630
3 | timeCreated: 1499924129
--------------------------------------------------------------------------------
/Source/Script/Core/Input.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fe053127496a4b73bbdc0a82d5584d20
3 | folderAsset: yes
4 | timeCreated: 1510672886
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Source/Script/Core/Input/Input.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e1c3879770ff40a59a6921cae899f12a
3 | timeCreated: 1499924249
--------------------------------------------------------------------------------
/Source/Script/Core/Input/InputFactory.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 97d0c87247b5456a9dd66d53c5c2b99b
3 | timeCreated: 1503559082
--------------------------------------------------------------------------------
/Source/Script/Core/Mutator.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b99116a4f7a1468aba711fcc0aa3fe25
3 | folderAsset: yes
4 | timeCreated: 1510672886
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Source/Script/Core/Mutator/Mutator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d1f50c07deeb4e7b8a8b1772977b23b2
3 | timeCreated: 1499924259
--------------------------------------------------------------------------------
/Source/Script/Core/Mutator/MutatorFactory.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f388c86c59494dbc8571dc97f50e5f7f
3 | timeCreated: 1503544715
--------------------------------------------------------------------------------
/Source/Script/Core/Mutator/Mutators.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7bed00657f2343d98b8c0af4dcab4500
3 | timeCreated: 1504495987
--------------------------------------------------------------------------------
/Source/Script/Core/Mutator/Mutators/DropdownOptionsMutator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 527d8e4446844f6fbd2c80ca8b16184a
3 | timeCreated: 1510125280
--------------------------------------------------------------------------------
/Source/Script/Core/Mutator/Mutators/IfElseMutator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b95aa7964b92419db99804bf64a169f9
3 | timeCreated: 1503546905
--------------------------------------------------------------------------------
/Source/Script/Core/Mutator/Mutators/IndexAtMutator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3edaea9da46e4036b029be7d000494c4
3 | timeCreated: 1504664944
--------------------------------------------------------------------------------
/Source/Script/Core/Mutator/Mutators/ItemListMutator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d4b7eb50e9ad4ce89b94f8e8a2dfa4e8
3 | timeCreated: 1504495787
--------------------------------------------------------------------------------
/Source/Script/Core/Mutator/Mutators/MathIsDivisibleByMutator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3fd2315c25874cdc98a292b42b93ba89
3 | timeCreated: 1504523683
--------------------------------------------------------------------------------
/Source/Script/Core/Mutator/ProcedureMutators.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d9f016ce1cfa4ed0925460d78136e1d9
3 | timeCreated: 1504496006
--------------------------------------------------------------------------------
/Source/Script/Core/Mutator/ProcedureMutators/Procedure.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3e1e6177db0f4ee09baaedc07ea8b5fc
3 | timeCreated: 1499924281
--------------------------------------------------------------------------------
/Source/Script/Core/Mutator/ProcedureMutators/ProcedureCallMutator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c6cd533a8be24ea681253e6e697931c6
3 | timeCreated: 1503650571
--------------------------------------------------------------------------------
/Source/Script/Core/Mutator/ProcedureMutators/ProcedureDB.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 98a65929e85c4f2e9f349bb8b85e53de
3 | timeCreated: 1503633736
--------------------------------------------------------------------------------
/Source/Script/Core/Mutator/ProcedureMutators/ProcedureDefinitionMutator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e4018b531e824acaba1938893575478d
3 | timeCreated: 1503650595
--------------------------------------------------------------------------------
/Source/Script/Core/Mutator/ProcedureMutators/ProcedureMutator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 46b2dd44fdb74889bc82c45652dc56fe
3 | timeCreated: 1503631451
--------------------------------------------------------------------------------
/Source/Script/Core/Utils.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ba4243cc6ad2483bb323a0bd6628fed9
3 | timeCreated: 1499924326
--------------------------------------------------------------------------------
/Source/Script/Core/Variable.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d17198b9941c4b3d9ef3c1d966e906bf
3 | folderAsset: yes
4 | timeCreated: 1510672886
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Source/Script/Core/Variable/VariableMap.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2affedc43e64471a954d76e1972e42f6
3 | timeCreated: 1499924331
--------------------------------------------------------------------------------
/Source/Script/Core/Variable/VariableModel.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f70825d314734254afcafb7ab2a2af57
3 | timeCreated: 1499924336
--------------------------------------------------------------------------------
/Source/Script/Core/Variable/Variables.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 00b7d5a747f34ecc9726bbeca60a981b
3 | timeCreated: 1501594341
--------------------------------------------------------------------------------
/Source/Script/Core/Workspace.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3d3e31bd0f954630a5b65bb0c43f3dca
3 | timeCreated: 1499857161
--------------------------------------------------------------------------------
/Source/Script/Core/Xml.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a861bdf177e9410996f2ad3c01a9210a
3 | timeCreated: 1499924411
--------------------------------------------------------------------------------
/Source/Script/I18n.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8c6914a1cbca49fba15368f86eb2e989
3 | timeCreated: 1501048772
--------------------------------------------------------------------------------
/Source/Script/I18n/I18n.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Copyright 2016 sophieml1989@gmail.com
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | ****************************************************************************/
18 |
19 | using System;
20 | using System.Collections.Generic;
21 | using Newtonsoft.Json.Linq;
22 |
23 | namespace UBlockly
24 | {
25 | public class I18n
26 | {
27 | public const string EN = "en";
28 | public const string CN = "cn";
29 |
30 | private static Dictionary mMsg = null;
31 |
32 | public static string Get(string key)
33 | {
34 | if (mMsg == null)
35 | BlockResMgr.Get().LoadI18n();
36 |
37 | string value;
38 | if (mMsg.TryGetValue(key, out value))
39 | return value;
40 |
41 | throw new Exception("I18n file doesn't contain translation for key: " + key);
42 | }
43 |
44 | public static void Add(string key, string value)
45 | {
46 | if (mMsg == null)
47 | BlockResMgr.Get().LoadI18n();
48 |
49 | mMsg[key] = value;
50 | }
51 |
52 | public static bool Contains(string key)
53 | {
54 | if (mMsg == null)
55 | BlockResMgr.Get().LoadI18n();
56 |
57 | return mMsg.ContainsKey(key);
58 | }
59 |
60 | public static void AddI18nFile(string text)
61 | {
62 | if (mMsg == null)
63 | mMsg = new Dictionary();
64 |
65 | JObject jobj = JObject.Parse(text);
66 | foreach (KeyValuePair pair in jobj)
67 | {
68 | mMsg[pair.Key] = pair.Value.ToString();
69 | }
70 | }
71 |
72 | public static void Dispose()
73 | {
74 | if (mMsg != null)
75 | mMsg.Clear();
76 | mMsg = null;
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/Source/Script/I18n/I18n.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b9143e9205b24a988bba31743ca9ed06
3 | timeCreated: 1501048781
--------------------------------------------------------------------------------
/Source/Script/I18n/MsgDefine.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1d9aa43074f24be0843fd3338869ec5d
3 | timeCreated: 1501398830
--------------------------------------------------------------------------------
/Source/Script/Res.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: dee3a0f0e8c94890a7925bbf180e2fa9
3 | timeCreated: 1510045591
--------------------------------------------------------------------------------
/Source/Script/Res/BlockResMgr.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d25e0c2162fdf4072833530d6c74a579
3 | timeCreated: 1505203538
4 |
--------------------------------------------------------------------------------
/Source/Script/Test.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a9cb213982974461085bf4e95f3ed141
3 | folderAsset: yes
4 | timeCreated: 1500642855
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Source/Script/Test/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a0211a1e882414c7198f7680f33cecc3
3 | folderAsset: yes
4 | timeCreated: 1500642806
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/Code.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 738a132ab13641318088e1d157e5b5fc
3 | timeCreated: 1501144464
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/Code/GeneratorTest.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 |
3 | namespace UBlockly.Test
4 | {
5 | public class GeneratorTest
6 | {
7 | [Test]
8 | public void TestPrefix()
9 | {
10 | var generator = new CSharpGenerator(null);
11 | Assert.AreEqual("", generator.PrefixLines("", ""), "Prefix nothing.");
12 | Assert.AreEqual("@Hello", generator.PrefixLines("Hello", "@"), "Prefix a word");
13 | Assert.AreEqual("12Hello\n", generator.PrefixLines("Hello\n", "12"), "Prefix one line");
14 | Assert.AreEqual("***Hello\n***World\n", generator.PrefixLines("Hello\nWorld\n", "***"), "Prefix two lines");
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/Code/GeneratorTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 497561a26a9c4ca6b6afb891e9672239
3 | timeCreated: 1502551665
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/Connection.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9698da7c0ec345f7874831fdebd9be54
3 | timeCreated: 1502361345
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/Connection/ConnectionDBTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ed2ff05e3b4d4c4484091521058defe6
3 | timeCreated: 1502423338
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/Connection/ConnectionTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a1f4b1360f7d441f9a05c41355c041f8
3 | timeCreated: 1502361353
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/Field.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5867606fb37c49ecb0d20ef72d5c1ed8
3 | timeCreated: 1502012708
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/Field/FieldAngleTest.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 |
3 | namespace UBlockly.Test
4 | {
5 | public class FieldAngleTest
6 | {
7 | [Test]
8 | public void TestFieldAngleConstructor()
9 | {
10 | Assert.AreEqual(new FieldAngle(null).GetValue(), "0");
11 | Assert.AreEqual(new FieldAngle(null, "").GetValue(), "0");
12 | Assert.AreEqual(new FieldAngle(null, new Number(1)).GetValue(), "1");
13 | Assert.AreEqual(new FieldAngle(null, new Number(1.5f)).GetValue(), "1.5");
14 | Assert.AreEqual(new FieldAngle(null, "2").GetValue(), "2");
15 | Assert.AreEqual(new FieldAngle(null, "2.5").GetValue(), "2.5");
16 | Assert.AreEqual(new FieldAngle(null, "bad").GetValue(), "0");
17 | Assert.AreEqual(new FieldAngle(null, new Number()).GetValue(), "0");
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/Field/FieldAngleTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fa4cf0ec787f43b9996cbdec5e03aaa8
3 | timeCreated: 1502179697
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/Field/FieldNumberTest.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 |
3 | namespace UBlockly.Test
4 | {
5 | public class FieldNumberTest
6 | {
7 | [Test]
8 | public void TestFieldNumberConstructor()
9 | {
10 | var field = new FieldNumber(null);
11 | Assert.AreEqual("0", field.GetValue());
12 |
13 | //numeric values
14 | field = new FieldNumber(null, new Number(1), Number.NaN, Number.NaN);
15 | Assert.AreEqual(field.GetValue(), "1");
16 | field = new FieldNumber(null, new Number(1.5f), Number.NaN, Number.NaN);
17 | Assert.AreEqual(field.GetValue(), "1.5");
18 |
19 | //string values
20 | field = new FieldNumber(null, "2");
21 | Assert.AreEqual(field.GetValue(), "2");
22 | field = new FieldNumber(null, "2.5");
23 | Assert.AreEqual(field.GetValue(), "2.5");
24 |
25 | field = new FieldNumber(null, new Number(0), new Number(-128), new Number(127));
26 | Assert.AreEqual(field.GetValue(), "0");
27 | Assert.AreEqual(field.Min.Value, -128);
28 | Assert.AreEqual(field.Max.Value, 127);
29 |
30 | field = new FieldNumber(null, "bad");
31 | Assert.AreEqual(field.GetValue(), "0");
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/Field/FieldNumberTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fa1148b0070d40499239099471b137c1
3 | timeCreated: 1502032935
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/Field/FieldVariableTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cec6e0281e7444279d117bad61b6d88a
3 | timeCreated: 1502012727
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/InputTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9798e115e2bd4620ab675393fe388f20
3 | timeCreated: 1501588752
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/JsonTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: afe11f846e6f545d2be3d5fcb69b06e8
3 | timeCreated: 1501038439
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/TestHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using NUnit.Framework;
5 |
6 | namespace UBlockly.Test
7 | {
8 | ///
9 | /// TODO:rename 2 BlocklyTestHelper
10 | ///
11 | public static class TestHelper
12 | {
13 | ///
14 | /// Check that two arrays have the same content.
15 | ///
16 | public static void IsEqualArrays(T[] array1, T[] array2)
17 | {
18 | Assert.AreEqual(array1.Length, array2.Length);
19 | for (int i = 0; i < array1.Length; i++)
20 | {
21 | Assert.AreEqual(array1[i], array2[i]);
22 | }
23 | }
24 |
25 | ///
26 | /// Check that two list have the same content.
27 | ///
28 | public static void IsEqualList(List list1, List list2)
29 | {
30 | Assert.AreEqual(list1.Count, list2.Count);
31 | for (int i = 0; i < list1.Count; i++)
32 | {
33 | Assert.AreEqual(list1[i], list2[i]);
34 | }
35 | }
36 |
37 | ///
38 | /// Check if a variable with the given values exists.
39 | ///
40 | /// {Blockly.Workspace|Blockly.VariableMap}
41 | public static void CheckVariableValues(object container, string name, string type, string id)
42 | {
43 | VariableMap variableMap = container as VariableMap;
44 | if (variableMap == null)
45 | {
46 | Workspace workspace = container as Workspace;
47 | if (workspace != null)
48 | variableMap = workspace.VariableMap;
49 | }
50 |
51 | if (variableMap == null)
52 | throw new Exception("calls TestHelper.CheckVariableValues, argument container must be Worspace or VariableMap");
53 |
54 | VariableModel variable = variableMap.GetVariableById(id);
55 | Assert.NotNull(variable);
56 | Assert.AreEqual(name, variable.Name);
57 | Assert.AreEqual(type, variable.Type);
58 | Assert.AreEqual(id, variable.ID);
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/TestHelper.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7a7a46d700fd44e29d4c0ecc3a25969b
3 | timeCreated: 1501558731
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/UtilsTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ec8cb51297df945ed9483f3a2b66bd02
3 | timeCreated: 1501037654
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/VariableTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 00b01cfa9286403aa5a48d19ac3e6667
3 | timeCreated: 1501498653
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/WorkspaceTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 835b2402d89c24890ab5fc57381d6166
3 | timeCreated: 1500642808
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Source/Script/Test/Editor/XmlTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 23742c129ede478fae4e59c64944a087
3 | timeCreated: 1502003607
--------------------------------------------------------------------------------
/Source/Script/UGUIView.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6b091d273c144acdbe4dbae04d94ec82
3 | timeCreated: 1504686614
--------------------------------------------------------------------------------
/Source/Script/UGUIView/BlockStatusView.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 89e09c7ba04c4325ae86f921f3762654
3 | timeCreated: 1509604168
--------------------------------------------------------------------------------
/Source/Script/UGUIView/BlockViewBuilder.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4127921e217f4b7db8228972fae71286
3 | timeCreated: 1504854350
--------------------------------------------------------------------------------
/Source/Script/UGUIView/BlockViewFactory.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Copyright 2016 sophieml1989@gmail.com
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | ****************************************************************************/
18 |
19 |
20 | using System;
21 | using System.Collections.Generic;
22 | using UnityEngine;
23 |
24 | namespace UBlockly.UGUI
25 | {
26 | ///
27 | /// factory to create block view
28 | /// developers can change this to static class and customnly load prefabs from Assetbundles or Resources.
29 | ///
30 | public static class BlockViewFactory
31 | {
32 | public static BlockView CreateView(Block block)
33 | {
34 | BlockView blockView;
35 |
36 | GameObject blockPrefab = BlockResMgr.Get().LoadBlockViewPrefab(block.Type);
37 | if (blockPrefab != null)
38 | {
39 | // has been builded beforehand
40 | GameObject blockObj = GameObject.Instantiate(blockPrefab);
41 | blockObj.name = blockPrefab.name;
42 |
43 | blockView = blockObj.GetComponent();
44 | blockView.BindModel(block);
45 |
46 | // rebuild inputs for mutation blocks
47 | if (block.Mutator != null)
48 | BlockViewBuilder.BuildInputViews(block, blockView);
49 |
50 | blockView.BuildLayout();
51 | }
52 | else
53 | {
54 | blockPrefab = BlockViewBuilder.BuildBlockView(block);
55 |
56 | blockView = blockPrefab.GetComponent();
57 | blockView.BindModel(block);
58 |
59 | // BlockViewBuilder.BuildBlockView will do both "BuildInputViews" and "BuildLayout"
60 | }
61 |
62 | blockView.ChangeBgColor(BlocklyUI.WorkspaceView.Toolbox.GetColorOfBlockView(blockView));
63 |
64 | return blockView;
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Source/Script/UGUIView/BlockViewFactory.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a0e0001f50884aa9a337584488120ac0
3 | timeCreated: 1505203538
--------------------------------------------------------------------------------
/Source/Script/UGUIView/BlockViewSettings.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d8f9cfbe84d04eb5961fba167ecbbb02
3 | timeCreated: 1504860252
--------------------------------------------------------------------------------
/Source/Script/UGUIView/BlocklyUI.cs:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 |
3 | Copyright 2016 sophieml1989@gmail.com
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | ****************************************************************************/
18 |
19 |
20 | using System;
21 | using UnityEngine;
22 | using Object = UnityEngine.Object;
23 |
24 | namespace UBlockly.UGUI
25 | {
26 | public static class BlocklyUI
27 | {
28 | public static WorkspaceView WorkspaceView;
29 | public static Canvas UICanvas;
30 |
31 | public static void NewWorkspace()
32 | {
33 | if (WorkspaceView != null)
34 | throw new Exception("BlocklyUI.NewWorkspace- there is already a workspace");
35 |
36 | Workspace workspace = new Workspace(new Workspace.WorkspaceOptions());
37 | WorkspaceView = Object.FindObjectOfType();
38 | WorkspaceView.BindModel(workspace);
39 |
40 | UICanvas = WorkspaceView.GetComponentInParent