Beispiel #1
0
        public override void DrawProperties(BloxEditorWindow ed, BloxBlockEd bdi)
        {
            //Debug.Log("DrawProperties");
            if (bdi.b.paramBlocks == null)
            {
                bdi.b.paramBlocks = new BloxBlock[0];
            }
            Debug_Block debug_Block = (Debug_Block)bdi.b;

            EditorGUILayout.PrefixLabel(Debug_BlockDrawer.GC_Message);
            debug_Block.message = EditorGUILayout.TextField(debug_Block.message);
            debug_Block.logType = (Debug_Block.DebugBlockLogType)EditorGUILayout.EnumPopup((Enum)(object)debug_Block.logType);
            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button(Debug_BlockDrawer.GC_Add, plyEdGUI.Styles.MiniButtonLeft, GUILayout.Width(30f)))
            {
                ArrayUtility.Add <BloxBlockEd>(ref bdi.paramBlocks, (BloxBlockEd)null);
                ArrayUtility.Add <BloxBlock>(ref bdi.b.paramBlocks, (BloxBlock)null);
                GUI.changed = true;
            }
            GUI.enabled = (bdi.paramBlocks.Length != 0);
            if (GUILayout.Button(Debug_BlockDrawer.GC_Remove, plyEdGUI.Styles.MiniButtonRight, GUILayout.Width(30f)))
            {
                ArrayUtility.RemoveAt <BloxBlockEd>(ref bdi.paramBlocks, bdi.paramBlocks.Length - 1);
                ArrayUtility.RemoveAt <BloxBlock>(ref bdi.b.paramBlocks, bdi.b.paramBlocks.Length - 1);
                GUI.changed = true;
            }
            GUI.enabled = true;
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
            GUILayout.Label(Debug_BlockDrawer.GC_Info, plyEdGUI.Styles.WordWrappedLabel);
        }
Beispiel #2
0
        public override void DrawFields(BloxEditorWindow ed, BloxBlockEd bdi)
        {
            Comment_Block comment_Block = (Comment_Block)bdi.b;

            Comment_BlockDrawer.GC_Message.text = comment_Block.message;
            GUILayout.Label(Comment_BlockDrawer.GC_Message, BloxEdGUI.Styles.ActionLabel);
        }
        public override void DrawHead(BloxEditorWindow ed, BloxBlockEd bdi)
        {
            Variable_Block variable_Block = (Variable_Block)bdi.b;

            Variable_BlockDrawer.GC_VarName.text = variable_Block.varName;
            if (bdi.owningBlock == null)
            {
                GUILayout.Label(Variable_BlockDrawer.GC_Set, BloxEdGUI.Styles.ActionLabel);
                GUILayout.Label(Variable_BlockDrawer.GC_Ico[(int)variable_Block.varType], BloxEdGUI.Styles.IconLabel);
                GUILayout.Label(Variable_BlockDrawer.GC_VarName, BloxEdGUI.Styles.ActionBoldLabel);
                GUILayout.Label(Variable_BlockDrawer.GC_Eq, BloxEdGUI.Styles.ActionLabel);
            }
            else
            {
                GUILayout.Label(Variable_BlockDrawer.GC_Ico[(int)variable_Block.varType], BloxEdGUI.Styles.IconLabel);
                GUILayout.Label(Variable_BlockDrawer.GC_VarName, BloxEdGUI.Styles.ActionLabel);
                if (bdi.b.paramBlocks[0] != null)
                {
                    bdi.b.paramBlocks[0] = null;
                    bdi.paramBlocks[0]   = null;
                    GUI.changed          = true;
                }
                if (variable_Block.varType == plyVariablesType.Object)
                {
                    ed.DrawBlockField(null, bdi, 1);
                }
                else if (bdi.b.paramBlocks[1] != null)
                {
                    bdi.b.paramBlocks[1] = null;
                    bdi.paramBlocks[1]   = null;
                    GUI.changed          = true;
                }
            }
        }
        public override void DrawProperties(BloxEditorWindow ed, BloxBlockEd bdi)
        {
            Type_Block obj = (Type_Block)bdi.b;

            EditorGUILayout.PrefixLabel(Type_BlockDrawer.GC_Message);
            obj.typeName = EditorGUILayout.TextField(obj.typeName);
        }
Beispiel #5
0
 public void DoGUI(EditorWindow ed, Vector2 lowerRight)
 {
     this.ed = ed;
     if (this.DockedState == PropsDockState.Hidden)
     {
         GUILayout.BeginArea(new Rect((float)(lowerRight.x - 35.0), (float)(lowerRight.y - 20.0), 28f, 20f), BloxEdGUI.Styles.PropsPanel);
         if (GUILayout.Button(BloxPropsPanel.GC_Dock[(int)this.DockedState], plyEdGUI.Styles.SmallButtonFlat, GUILayout.Width(20f)))
         {
             this.DockedState = PropsDockState.CanvasBig;
             EditorPrefs.SetInt("Blox.PropsPanelDockState", (int)this.DockedState);
             this.RezizePanel();
             BloxEditorWindow instance = BloxEditorWindow.Instance;
             if ((object)instance != null)
             {
                 instance.Repaint();
             }
         }
         GUILayout.EndArea();
     }
     else
     {
         this.propsRect.x = lowerRight.x - this.propsRect.width;
         this.propsRect.y = lowerRight.y - this.propsRect.height;
         GUILayout.BeginArea(this.propsRect, BloxEdGUI.Styles.PropsPanel);
         EditorGUILayout.BeginHorizontal(plyEdGUI.Styles.TopBar);
         GUILayout.Label((this.shownDef == null) ? " " : this.shownDef.name, BloxEdGUI.Styles.PropsHead, GUILayout.Width((float)(this.propsRect.width - 60.0)));
         if (this.shownDef != null && this.shownDef.bloxdoc != null && !string.IsNullOrEmpty(this.shownDef.bloxdoc.url))
         {
             if (GUILayout.Button(BloxPropsPanel.GC_Help, plyEdGUI.Styles.SmallButtonFlat, GUILayout.Width(20f)))
             {
                 Application.OpenURL(this.shownDef.bloxdoc.url);
             }
         }
         else
         {
             GUILayout.Space(24f);
         }
         if (GUILayout.Button(BloxPropsPanel.GC_Dock[(int)this.DockedState], plyEdGUI.Styles.SmallButtonFlat, GUILayout.Width(20f)))
         {
             this.DockedState++;
             if (this.DockedState > PropsDockState.Hidden)
             {
                 this.DockedState = PropsDockState.CanvasBig;
             }
             EditorPrefs.SetInt("Blox.PropsPanelDockState", (int)this.DockedState);
             this.RezizePanel();
             ed.Repaint();
         }
         EditorGUILayout.EndHorizontal();
         this.scroll = EditorGUILayout.BeginScrollView(this.scroll);
         if (this.shownDef != null)
         {
             this.DrawProperties();
             BloxEd.Instance.DrawBloxDoc(this.shownDef, true, ed);
         }
         EditorGUILayout.Space();
         EditorGUILayout.EndScrollView();
         GUILayout.EndArea();
     }
 }
Beispiel #6
0
        public void DrawBloxList()
        {
            int num = plyEdGUI.List <Blox>(ref this.selectedBloxIdx, BloxEd.BloxGlobalObj.bloxDefs, ref this.scroll, this.listOps, new GUILayoutOption[0]);

            switch (num)
            {
            case 1:
                if (BloxEdGlobal.DoubleClickOpenBloxDef)
                {
                    break;
                }
                goto case 2;

            case 2:
                if (this.selectedBloxIdx >= 0 && this.selectedBloxIdx < BloxEd.BloxGlobalObj.bloxDefs.Count)
                {
                    BloxEditorWindow.Show_BloxEditorWindow(BloxEd.BloxGlobalObj.bloxDefs[this.selectedBloxIdx]);
                }
                return;
            }
            if (num >= 3)
            {
                num -= 3;
                plyEdGUI.ClearFocus();
                DragAndDrop.PrepareStartDrag();
                DragAndDrop.objectReferences = new Object[0];
                DragAndDrop.paths            = null;
                DragAndDrop.SetGenericData("BloxDefinition", BloxEd.BloxGlobalObj.bloxDefs[num]);
                DragAndDrop.StartDrag(BloxEd.BloxGlobalObj.bloxDefs[num].screenName);
                Event.current.Use();
            }
        }
Beispiel #7
0
 private void OnDoubleClick()
 {
     if (this.list.index >= 0 && this.list.index < this.targetBloxCache.Count)
     {
         BloxEditorWindow.Show_BloxEditorWindow(this.targetBloxCache[this.list.index]);
     }
 }
        public override void DrawProperties(BloxEditorWindow ed, BloxBlockEd bdi)
        {
            Variable_Block variable_Block = (Variable_Block)bdi.b;

            EditorGUIUtility.labelWidth = 75f;
            variable_Block.varType      = (plyVariablesType)EditorGUILayout.Popup(Variable_BlockDrawer.GC_Type, (int)variable_Block.varType, Variable_BlockDrawer.GC_VarTypeNames);
            variable_Block.varName      = EditorGUILayout.TextField(Variable_BlockDrawer.GC_Name, variable_Block.varName);
        }
Beispiel #9
0
        public override void DrawProperties(BloxEditorWindow ed, BloxBlockEd bdi)
        {
            if (bdi.b.paramBlocks == null)
            {
                bdi.b.paramBlocks = new BloxBlock[0];
            }
            Comment_Block obj = (Comment_Block)bdi.b;

            EditorGUILayout.PrefixLabel(Comment_BlockDrawer.GC_Head);
            obj.message = EditorGUILayout.TextArea(obj.message, plyEdGUI.Styles.TextArea);
        }
        protected void OnDestroy()
        {
            BloxBlocksWindow.Instance     = null;
            BloxEdGlobal.BlocksListDocked = true;
            EditorPrefs.SetBool("Blox.BlocksListDocked", BloxEdGlobal.BlocksListDocked);
            BloxEditorWindow instance = BloxEditorWindow.Instance;

            if ((object)instance != null)
            {
                instance.Repaint();
            }
        }
Beispiel #11
0
        public static void UpdateBlockTheme()
        {
            if (BloxEdGlobal.BlockTheme < 0 || BloxEdGlobal.BlockTheme >= BloxEdGUI.BlockThemeNames.Length)
            {
                BloxEdGlobal.BlockTheme = 0;
            }
            BloxEdGUI.themeName = BloxEdGUI.BlockThemeNames[BloxEdGlobal.BlockTheme].text;
            BloxEdGUI.Styles.ActionLabel.normal.textColor     = BloxEdGUI.BlockFontColour();
            BloxEdGUI.Styles.ActionBoldLabel.normal.textColor = BloxEdGUI.BlockFontColour();
            BloxEdGUI.Styles.FieldLabel.normal.textColor      = BloxEdGUI.BlockFontColour();
            BloxEdGUI.Styles.ValueLabel.normal.textColor      = BloxEdGUI.BlockFontColour();
            BloxEdGUI.Styles.IconLabel.normal.textColor       = BloxEdGUI.BlockFontColour();
            for (int i = 0; i < BloxEdGUI.Styles.Event.Length; i++)
            {
                BloxEdGUI.Styles.Event[i].normal.background   = BloxEdGUI.LoadBlockTexture("event" + i);
                BloxEdGUI.Styles.Event[i].onNormal.background = BloxEdGUI.LoadBlockTexture("event" + i);
                BloxEdGUI.Styles.Event[i].normal.textColor    = BloxEdGUI.BlockFontColour();
                BloxEdGUI.Styles.Event[i].onNormal.textColor  = BloxEdGUI.BlockFontColour();
            }
            for (int j = 0; j < BloxEdGUI.Styles.Value.Length; j++)
            {
                BloxEdGUI.Styles.Value[j].normal.background = BloxEdGUI.LoadBlockTexture("value" + j);
                BloxEdGUI.Styles.Value[j].normal.textColor  = BloxEdGUI.BlockFontColour();
            }
            foreach (KeyValuePair <string, GUIStyle[]> item in BloxEdGUI.Styles.Action)
            {
                for (int k = 0; k < item.Value.Length; k++)
                {
                    item.Value[k].normal.background = BloxEdGUI.LoadBlockTexture("act_" + item.Key + ".action" + k);
                    item.Value[k].normal.textColor  = BloxEdGUI.BlockFontColour();
                }
            }
            for (int l = 0; l < BloxEdGUI.Styles.Container.Length; l++)
            {
                BloxEdGUI.Styles.Container[l].normal.background = BloxEdGUI.LoadBlockTexture("container" + l);
                BloxEdGUI.Styles.Container[l].normal.textColor  = BloxEdGUI.BlockFontColour();
            }
            for (int m = 0; m < BloxEdGUI.Styles.Select.Length; m++)
            {
                BloxEdGUI.Styles.Select[m].normal.background = BloxEdGUI.LoadBlockTexture("select" + m);
                BloxEdGUI.Styles.Select[m].normal.textColor  = BloxEdGUI.BlockFontColour();
            }
            BloxEdGUI.Styles.Error.normal.background = BloxEdGUI.LoadBlockTexture("error0");
            BloxEditorWindow instance = BloxEditorWindow.Instance;

            if ((object)instance != null)
            {
                instance.Repaint();
            }
        }
Beispiel #12
0
        protected void OnEnable()
        {
            Debug.Log("OnEnable", "BloxListWindow", UnityEngine.Color.yellow);
            BloxListWindow.Instance = this;
            Texture2D image = plyEdGUI.LoadTextureResource("BloxEditor.res.icons.blox_mono" + (plyEdGUI.IsDarkSkin() ? "_p" : "") + ".png", typeof(BloxListWindow).Assembly, FilterMode.Point, TextureWrapMode.Clamp);

            base.titleContent = new GUIContent("BloxDefs", image);
            BloxEd.LoadBloxGlobal();
            if (this.listOps == null)
            {
                this.listOps = new plyEdGUI.ListOps
                {
                    emptyMsg       = "No Blox defined",
                    drawBackground = false,
                    onDrawElement  = this.DrawElement,
                    onAction       = this.ListAction,
                    extraButtons   = new plyEdGUI.ListOpsExtraToolbarButton[2]
                    {
                        new plyEdGUI.ListOpsExtraToolbarButton
                        {
                            label    = new GUIContent(Ico._rename, "Rename selected Blox Definition"),
                            callback = delegate
                            {
                                plyTextInputWiz.ShowWiz("Rename Blox", "", BloxEd.BloxGlobalObj.bloxDefs[this.selectedBloxIdx].screenName, this.OnRenameBloxDef, null, 250f);
                            },
                            enabled = (() => this.selectedBloxIdx >= 0)
                        },
                        new plyEdGUI.ListOpsExtraToolbarButton
                        {
                            label    = new GUIContent(Ico._blox + "Edit", "Edit in Blox Editor"),
                            callback = delegate
                            {
                                BloxEditorWindow.Show_BloxEditorWindow(BloxEd.BloxGlobalObj.bloxDefs[this.selectedBloxIdx]);
                            },
                            enabled = (() => this.selectedBloxIdx >= 0)
                        }
                    },
                    canAdd            = true,
                    canDuplicate      = false,
                    canRemove         = true,
                    canChangePosition = false,
                    addLabel          = BloxListWindow.GC_Add,
                    removeLabel       = BloxListWindow.GC_Remove,
                    duplicateLabel    = BloxListWindow.GC_Duplicate
                };
            }
        }
 public override void DrawFields(BloxEditorWindow ed, BloxBlockEd bdi)
 {
     if (bdi.owningBlock == null)
     {
         Variable_Block obj = (Variable_Block)bdi.b;
         ed.DrawBlockField(null, bdi, 0);
         if (obj.varType == plyVariablesType.Object)
         {
             ed.DrawBlockField(null, bdi, 1);
         }
         else if (bdi.b.paramBlocks[1] != null)
         {
             bdi.b.paramBlocks[1] = null;
             bdi.paramBlocks[1]   = null;
             GUI.changed          = true;
         }
     }
 }
Beispiel #14
0
 public override void DrawFields(BloxEditorWindow ed, BloxBlockEd bdi)
 {
     if (bdi.b.paramBlocks == null)
     {
         bdi.b.paramBlocks = new BloxBlock[0];
     }
     GUILayout.Label(((Debug_Block)bdi.b).message, BloxEdGUI.Styles.FieldLabel);
     if (bdi.paramBlocks.Length != 0)
     {
         for (int i = 0; i < bdi.paramBlocks.Length; i++)
         {
             if (i != 0)
             {
                 GUILayout.Label(Debug_BlockDrawer.GC_Comma, BloxEdGUI.Styles.FieldLabel);
             }
             ed.DrawBlockField(null, bdi, i);
         }
     }
 }
 public override void DrawFields(BloxEditorWindow ed, BloxBlockEd bdi)
 {
     ed.DrawBlockField(null, bdi, 0);
     ed.DrawBlockField(null, bdi, 1);
     ed.DrawBlockField(null, bdi, 2);
     GUILayout.Label(TriggeEvent_BlockDrawer.GC_Seconds, BloxEdGUI.Styles.FieldLabel);
     if (bdi.paramBlocks.Length > 3)
     {
         TriggerEvent_Block _ = (TriggerEvent_Block)bdi.b;
         GUILayout.Label(TriggeEvent_BlockDrawer.GC_With, BloxEdGUI.Styles.FieldLabel);
         for (int i = 3; i < bdi.paramBlocks.Length; i++)
         {
             TriggeEvent_BlockDrawer.GC_Param.text = "param" + (i - 3).ToString() + "=";
             GUILayout.Label(TriggeEvent_BlockDrawer.GC_EventVar, BloxEdGUI.Styles.IconLabel);
             GUILayout.Label(TriggeEvent_BlockDrawer.GC_Param, BloxEdGUI.Styles.FieldLabel);
             ed.DrawBlockField(null, bdi, i);
         }
     }
 }
Beispiel #16
0
        private void OnRenameBloxDef(plyTextInputWiz wiz)
        {
            string text = wiz.text;

            wiz.Close();
            if (!string.IsNullOrEmpty(text))
            {
                BloxEd.BloxGlobalObj.bloxDefs[this.selectedBloxIdx].screenName = text;
                plyEdUtil.SetDirty(BloxEd.BloxGlobalObj.bloxDefs[this.selectedBloxIdx]);
                BloxEd.SortBloxDefList();
                base.Repaint();
                BloxEditorWindow instance = BloxEditorWindow.Instance;
                if ((object)instance != null)
                {
                    instance.Repaint();
                }
                plyEdUtil.RepaintInspector(typeof(BloxContainer));
            }
        }
        public override void DrawProperties(BloxEditorWindow ed, BloxBlockEd bdi)
        {
            TriggerEvent_Block _ = (TriggerEvent_Block)bdi.b;

            GUILayout.Label(TriggeEvent_BlockDrawer.GC_EventsVars);
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button(TriggeEvent_BlockDrawer.GC_Add, plyEdGUI.Styles.MiniButtonLeft, GUILayout.Width(30f)))
            {
                ArrayUtility.Add <BloxBlockEd>(ref bdi.paramBlocks, (BloxBlockEd)null);
                ArrayUtility.Add <BloxBlock>(ref bdi.b.paramBlocks, (BloxBlock)null);
                GUI.changed = true;
            }
            GUI.enabled = (bdi.paramBlocks.Length > 3);
            if (GUILayout.Button(TriggeEvent_BlockDrawer.GC_Remove, plyEdGUI.Styles.MiniButtonRight, GUILayout.Width(30f)))
            {
                ArrayUtility.RemoveAt <BloxBlockEd>(ref bdi.paramBlocks, bdi.paramBlocks.Length - 1);
                ArrayUtility.RemoveAt <BloxBlock>(ref bdi.b.paramBlocks, bdi.b.paramBlocks.Length - 1);
                GUI.changed = true;
            }
            GUI.enabled = true;
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
        }
Beispiel #18
0
        private void OnRenameBloxDef(plyTextInputWiz wiz)
        {
            string text = wiz.text;

            wiz.Close();
            if (!string.IsNullOrEmpty(text))
            {
                this.targetBloxCache[this.list.index].screenName = text;
                plyEdUtil.SetDirty(this.targetBloxCache[this.list.index]);
                BloxEd.SortBloxDefList();
                base.Repaint();
                BloxListWindow instance = BloxListWindow.Instance;
                if ((object)instance != null)
                {
                    instance.Repaint();
                }
                BloxEditorWindow instance2 = BloxEditorWindow.Instance;
                if ((object)instance2 != null)
                {
                    instance2.Repaint();
                }
            }
        }
Beispiel #19
0
 private void OnSelectBlox()
 {
     this.activeVars   = null;
     this.selectedBlox = this.targetBloxCache[this.list.index];
     if ((UnityEngine.Object) this.selectedBlox != (UnityEngine.Object)null)
     {
         if (this.selectedBlox.variables.varDefs.Count == 0)
         {
             this.selectedBlox.variables.Serialize();
             this.selectedBlox.variables.Deserialize(false);
         }
         BloxContainerInspector.GC_VarsHead.text = "Variables of: " + this.selectedBlox.screenName;
         this.activeVars = this.Target.GetBloxVariables(this.selectedBlox.ident, this.selectedBlox);
         this.activeVars._SetDirty();
         this.Save();
         this.varEditor.SetTarget(this.activeVars, this.Target.gameObject);
         base.Repaint();
     }
     if (!BloxEdGlobal.DoubleClickOpenBloxDef && this.list.index >= 0 && this.list.index < this.targetBloxCache.Count)
     {
         BloxEditorWindow.Show_BloxEditorWindow(this.targetBloxCache[this.list.index]);
     }
 }
Beispiel #20
0
        private int ListAction(plyEdGUI.ListOps.ListAction act)
        {
            switch (act)
            {
            case plyEdGUI.ListOps.ListAction.DoAdd:
                BloxEd.CreateNewBloxDef();
                this.selectedBloxIdx = -1;
                break;

            case plyEdGUI.ListOps.ListAction.DoRemoveSelected:
                if (EditorUtility.DisplayDialog("Blox", "Delete Blox Definition. This can't be undone. Are you sure?", "Yes", "Cancel"))
                {
                    BloxEd.DeleteBloxDef(BloxEd.BloxGlobalObj.bloxDefs[this.selectedBloxIdx]);
                    BloxEditorWindow instance = BloxEditorWindow.Instance;
                    if ((object)instance != null)
                    {
                        instance.Repaint();
                    }
                    plyEdUtil.RepaintInspector(typeof(BloxContainer));
                }
                break;
            }
            return(-1);
        }
Beispiel #21
0
 public abstract void DrawProperties(BloxEditorWindow ed, BloxBlockEd bdi);
Beispiel #22
0
 public abstract void DrawFields(BloxEditorWindow ed, BloxBlockEd bdi);
Beispiel #23
0
 public abstract void DrawHead(BloxEditorWindow ed, BloxBlockEd bdi);
Beispiel #24
0
 public override void DrawFields(BloxEditorWindow ed, BloxBlockEd bdi)
 {
     ed.DrawBlockField(null, bdi, 0);
     GUILayout.Label(bdi.def.paramDefs[2].name, BloxEdGUI.Styles.ActionBoldLabel);
     ed.DrawBlockField(null, bdi, 1);
 }
 public override void DrawProperties(BloxEditorWindow ed, BloxBlockEd bdi)
 {
 }
Beispiel #26
0
 public override void DrawHead(BloxEditorWindow ed, BloxBlockEd bdi)
 {
 }
Beispiel #27
0
 public override void DrawHead(BloxEditorWindow ed, BloxBlockEd bdi)
 {
     GUILayout.Label(Debug_BlockDrawer.GC_Head, BloxEdGUI.Styles.ActionLabel);
 }
Beispiel #28
0
 public override void DrawFields(BloxEditorWindow ed, BloxBlockEd bdi)
 {
     GUILayout.Label(NOT_BlockDrawer.GC_Not, BloxEdGUI.Styles.ActionBoldLabel);
     ed.DrawBlockField(null, bdi, 0);
 }
 public override void DrawHead(BloxEditorWindow ed, BloxBlockEd bdi)
 {
     GUILayout.Label(SelfGameObject_BlockDrawer.GC_Self, BloxEdGUI.Styles.FieldLabel);
 }
 public override void DrawFields(BloxEditorWindow ed, BloxBlockEd bdi)
 {
 }