Example #1
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();
     }
 }
        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();
            }
        }
Example #3
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();
            }
        }
Example #4
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));
            }
        }
Example #5
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();
                }
            }
        }
Example #6
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);
        }