public GUIWordWrapSizer(GUIStyle style, GUIContent content, GUILayoutOption[] options)
   : base(0.0f, 0.0f, 0.0f, 0.0f, style)
 {
   this.m_Content = new GUIContent(content);
   this.ApplyOptions(options);
   this.m_ForcedMinHeight = this.minHeight;
   this.m_ForcedMaxHeight = this.maxHeight;
 }
 private GUIGridSizer(GUIContent[] contents, int xCount, GUIStyle buttonStyle, GUILayoutOption[] options)
   : base(0.0f, 0.0f, 0.0f, 0.0f, GUIStyle.none)
 {
   this.m_Count = contents.Length;
   this.m_XCount = xCount;
   this.ApplyStyleSettings(buttonStyle);
   this.ApplyOptions(options);
   if (xCount == 0 || contents.Length == 0)
     return;
   float num1 = (float) (Mathf.Max(buttonStyle.margin.left, buttonStyle.margin.right) * (this.m_XCount - 1));
   float num2 = (float) (Mathf.Max(buttonStyle.margin.top, buttonStyle.margin.bottom) * (this.rows - 1));
   if ((double) buttonStyle.fixedWidth != 0.0)
     this.m_MinButtonWidth = this.m_MaxButtonWidth = buttonStyle.fixedWidth;
   if ((double) buttonStyle.fixedHeight != 0.0)
     this.m_MinButtonHeight = this.m_MaxButtonHeight = buttonStyle.fixedHeight;
   if ((double) this.m_MinButtonWidth == -1.0)
   {
     if ((double) this.minWidth != 0.0)
       this.m_MinButtonWidth = (this.minWidth - num1) / (float) this.m_XCount;
     if ((double) this.maxWidth != 0.0)
       this.m_MaxButtonWidth = (this.maxWidth - num1) / (float) this.m_XCount;
   }
   if ((double) this.m_MinButtonHeight == -1.0)
   {
     if ((double) this.minHeight != 0.0)
       this.m_MinButtonHeight = (this.minHeight - num2) / (float) this.rows;
     if ((double) this.maxHeight != 0.0)
       this.m_MaxButtonHeight = (this.maxHeight - num2) / (float) this.rows;
   }
   if ((double) this.m_MinButtonHeight == -1.0 || (double) this.m_MaxButtonHeight == -1.0 || ((double) this.m_MinButtonWidth == -1.0 || (double) this.m_MaxButtonWidth == -1.0))
   {
     float a1 = 0.0f;
     float a2 = 0.0f;
     foreach (GUIContent content in contents)
     {
       Vector2 vector2 = buttonStyle.CalcSize(content);
       a2 = Mathf.Max(a2, vector2.x);
       a1 = Mathf.Max(a1, vector2.y);
     }
     if ((double) this.m_MinButtonWidth == -1.0)
       this.m_MinButtonWidth = (double) this.m_MaxButtonWidth == -1.0 ? a2 : Mathf.Min(a2, this.m_MaxButtonWidth);
     if ((double) this.m_MaxButtonWidth == -1.0)
       this.m_MaxButtonWidth = (double) this.m_MinButtonWidth == -1.0 ? a2 : Mathf.Max(a2, this.m_MinButtonWidth);
     if ((double) this.m_MinButtonHeight == -1.0)
       this.m_MinButtonHeight = (double) this.m_MaxButtonHeight == -1.0 ? a1 : Mathf.Min(a1, this.m_MaxButtonHeight);
     if ((double) this.m_MaxButtonHeight == -1.0)
     {
       if ((double) this.m_MinButtonHeight != -1.0)
         this.maxHeight = Mathf.Max(this.maxHeight, this.m_MinButtonHeight);
       this.m_MaxButtonHeight = this.maxHeight;
     }
   }
   this.minWidth = this.m_MinButtonWidth * (float) this.m_XCount + num1;
   this.maxWidth = this.m_MaxButtonWidth * (float) this.m_XCount + num1;
   this.minHeight = this.m_MinButtonHeight * (float) this.rows + num2;
   this.maxHeight = this.m_MaxButtonHeight * (float) this.rows + num2;
 }
		public static int SelectionGrid(int selected, Texture[] images, int xCount, GUIStyle style, GUILayoutOption[] options){}
		private static Rect DoGetAspectRect(float aspect, GUIStyle style, GUILayoutOption[] options){}
Example #5
0
    public bool DrawIDWidget(BlueprintModelAsset asset, SerializedObject so, GUILayoutOption labelWidth, GUILayoutOption widgetWidth, string widgetID = null)
    {
        EditorGUI.BeginChangeCheck();
        EditorGUILayout.LabelField("ID", labelWidth);
        var idProp = so.FindProperty("ID");

        if (widgetID != null)
        {
            GUI.SetNextControlName(widgetID);
        }
        EditorGUILayout.PropertyField(idProp, GUIContent.none, widgetWidth);
        if (EditorGUI.EndChangeCheck())
        {
            so.ApplyModifiedProperties();
            BlueprintModelAsset.Rename(asset, idProp.stringValue);
            return(true);
        }
        return(false);
    }
		internal static void BeginWindow(int windowID, GUIStyle style, GUILayoutOption[] options){}
		public static Rect GetRect(float width, float height, GUIStyle style, GUILayoutOption[] options){}
		public static float VerticalScrollbar(float value, float size, float topValue, float bottomValue, GUIStyle style, GUILayoutOption[] options){}
		public static void BeginVertical(GUILayoutOption[] options){}
Example #10
0
            public static void DrawItemsDatabaseSelector(SerializedObject serializedObject,
                                                         SerializedProperty category, string categoryLabel,
                                                         SerializedProperty name, string nameLabel,
                                                         NamesDatabase database,
                                                         ColorName colorName)
            {
                if (s_namesList == null)
                {
                    s_namesList = new List <string>();
                }
                s_namesList.Clear();

                int  categorySelectedIndex = database.CategoryNames.Contains(category.stringValue) ? database.CategoryNames.IndexOf(category.stringValue) : database.CategoryNames.IndexOf(NamesDatabase.CUSTOM);
                bool hasCustomName         = category.stringValue.Equals(NamesDatabase.CUSTOM);
                int  nameSelectedIndex     = 0;

                if (!database.Contains(category.stringValue)) //database does not contain this category -> reset it to custom
                {
                    hasCustomName        = true;
                    category.stringValue = NamesDatabase.CUSTOM;
                }

                if (!hasCustomName)
                {
                    s_namesList = database.GetNamesList(category.stringValue);
                    if (s_namesList.Count == 0)
                    {
                        if (!database.GetNamesList(NamesDatabase.GENERAL, true).Contains(NamesDatabase.UNNAMED))
                        {
                            database.GetNamesList(NamesDatabase.GENERAL, true).Add(NamesDatabase.UNNAMED);
                            database.SetDirty(true);
                        }

                        category.stringValue = NamesDatabase.GENERAL;
                        s_namesList          = database.GetNamesList(category.stringValue);
                    }


                    if (s_namesList.Contains(name.stringValue))
                    {
                        nameSelectedIndex = s_namesList.IndexOf(name.stringValue);
                    }
                    else
                    {
                        if (category.stringValue.Equals(NamesDatabase.GENERAL))
                        {
                            name.stringValue  = NamesDatabase.UNNAMED;
                            nameSelectedIndex = s_namesList.IndexOf(NamesDatabase.UNNAMED);
                        }
                        else if (name.stringValue != NamesDatabase.UNNAMED && EditorUtility.DisplayDialog("Add Name", "Add the '" + name.stringValue + "' name to the '" + category.stringValue + "' category?", "Yes", "No"))
                        {
                            string cleanName = name.stringValue.Trim();
                            if (string.IsNullOrEmpty(cleanName))
                            {
                                name.stringValue = s_namesList[nameSelectedIndex];
                            }
                            else if (s_namesList.Contains(cleanName))
                            {
                                name.stringValue  = cleanName;
                                nameSelectedIndex = s_namesList.IndexOf(cleanName);
                            }
                            else
                            {
                                ListOfNames categoryAsset = database.GetCategory(category.stringValue);
                                categoryAsset.Names.Add(cleanName);
                                categoryAsset.SetDirty(false);
                                database.Sort(false, true);
                                name.stringValue  = cleanName;
                                nameSelectedIndex = s_namesList.IndexOf(name.stringValue);
                            }
                        }
                        else
                        {
                            name.stringValue = s_namesList[nameSelectedIndex];
                        }
                    }
                }

                float           lineHeight             = Properties.SingleLineHeight;
                float           backgroundHeight       = lineHeight * 2 + Properties.Space(2);
                GUILayoutOption backgroundHeightOption = GUILayout.Height(backgroundHeight);

                bool  isUnnamed    = name.stringValue.Equals(NamesDatabase.UNNAMED);
                Color initialColor = GUI.color;
                float labelAlpha   = Properties.TextIconAlphaValue(!isUnnamed);

                GUILayout.BeginHorizontal(backgroundHeightOption);
                {
                    GUILayout.BeginVertical(backgroundHeightOption);
                    {
                        Background.Draw(colorName, backgroundHeight);
                        GUILayout.Space(-backgroundHeight);
                        GUILayout.Space(Properties.Space());
                        GUILayout.BeginHorizontal();
                        GUILayout.Space(Properties.Space(2));
                        GUI.color = GUI.color.WithAlpha(labelAlpha);
                        Label.Draw(categoryLabel, Size.S, colorName);
                        GUI.color = initialColor;
                        GUILayout.EndHorizontal();

                        GUI.color = Colors.PropertyColor(colorName);
                        EditorGUI.BeginChangeCheck();
                        categorySelectedIndex = EditorGUILayout.Popup(categorySelectedIndex, database.CategoryNames.ToArray());
                        if (EditorGUI.EndChangeCheck())
                        {
                            category.stringValue = database.CategoryNames[categorySelectedIndex];
                            if (database.CategoryNames[categorySelectedIndex] != NamesDatabase.CUSTOM)
                            {
                                ListOfNames newCategory = database.GetCategory(database.CategoryNames[categorySelectedIndex]);

                                if (newCategory.Names.Count == 0)
                                {
                                    DDebug.Log("'" + database.CategoryNames[categorySelectedIndex] + "' " + Properties.Labels.CategoryIsEmpty);
                                }
                                else
                                {
                                    if (string.IsNullOrEmpty(name.stringValue.Trim()))
                                    {
                                        name.stringValue = database.GetNamesList(database.CategoryNames[categorySelectedIndex])[0];
                                    }
                                    else if (name.stringValue != NamesDatabase.UNNAMED && !database.GetNamesList(database.CategoryNames[categorySelectedIndex]).Contains(name.stringValue))
                                    {
                                        if (EditorUtility.DisplayDialog("Add Name", "Add the '" + name.stringValue + "' to the '" + database.CategoryNames[categorySelectedIndex] + "' category?", "Yes", "No"))
                                        {
                                            ListOfNames categoryAsset = database.GetCategory(database.CategoryNames[categorySelectedIndex]);
                                            categoryAsset.Names.Add(name.stringValue);
                                            categoryAsset.SetDirty(false);
                                            database.Sort(false, true);
                                        }
                                        else if (database.CategoryNames[categorySelectedIndex] == NamesDatabase.GENERAL)
                                        {
                                            name.stringValue = NamesDatabase.UNNAMED;
                                        }
                                        else
                                        {
                                            name.stringValue = database.GetNamesList(database.CategoryNames[categorySelectedIndex])[0];
                                        }
                                    }
                                    hasCustomName = false;
                                }
                            }

                            Properties.ResetKeyboardFocus();
                        }

                        GUI.color = initialColor;
                    }
                    GUILayout.EndVertical();
                    GUILayout.Space(Properties.Space());
                    GUILayout.BeginVertical(backgroundHeightOption);
                    {
                        Background.Draw(colorName, backgroundHeight);
                        GUILayout.Space(-backgroundHeight);
                        GUILayout.Space(Properties.Space());
                        GUILayout.BeginHorizontal();
                        GUILayout.Space(Properties.Space(2));
                        GUI.color = GUI.color.WithAlpha(labelAlpha);
                        Label.Draw(nameLabel, Size.S, colorName);
                        GUI.color = initialColor;
                        GUILayout.EndHorizontal();

                        GUI.color = Colors.PropertyColor(colorName);
                        if (hasCustomName)
                        {
                            EditorGUILayout.PropertyField(name, GUIContent.none, true);
                        }
                        else
                        {
                            EditorGUI.BeginChangeCheck();
                            nameSelectedIndex = EditorGUILayout.Popup(nameSelectedIndex, s_namesList.ToArray());
                            if (EditorGUI.EndChangeCheck())
                            {
                                name.stringValue = s_namesList[nameSelectedIndex];
                                Properties.ResetKeyboardFocus();
                            }
                        }

                        GUI.color = initialColor;
                    }
                    GUILayout.EndVertical();
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(-Properties.Space() - 1);
            }
Example #11
0
        public override void OnInspectorGUI()
        {
            gController = (NPCController)target;

            /*
             * Look for added compatible added components, extend with interface later on
             */
            /**/

            EditorGUI.BeginChangeCheck();

            /* Load Modules */
            if (gController.GetComponent <INPCModule>() != null)
            {
                gShowMods = EditorGUILayout.Foldout(gShowMods, "NPC Modules");
                if (gShowMods)
                {
                    gController.LoadNPCModules();
                    INPCModule[]      mods = gController.NPCModules;
                    GUILayoutOption[] ops  = new GUILayoutOption[1];
                    foreach (INPCModule m in mods)
                    {
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.LabelField(m.NPCModuleName());
                        m.SetEnable((bool)EditorGUILayout.Toggle((bool)m.IsEnabled()));
                        EditorGUILayout.EndHorizontal();
                    }
                }
            }
            else
            {
                EditorGUILayout.LabelField("No NPC Modules Loaded");
            }

            /* General Controller */
            gGeneralSettings = EditorGUILayout.Foldout(gGeneralSettings, "General Settings");
            if (gGeneralSettings)
            {
                gController.MainAgent = (bool)EditorGUILayout.Toggle(label_MainAgent, (bool)gController.MainAgent);
                gController.DebugMode = (bool)EditorGUILayout.Toggle(label_DebugPrint, (bool)gController.DebugMode);
                gController.DisplaySelectedHighlight = (bool)EditorGUILayout.Toggle(label_SelectHighlight, (bool)gController.DisplaySelectedHighlight);
                gController.TestNPC = (bool)EditorGUILayout.Toggle(label_TestNPC, (bool)gController.TestNPC);
                if (gController.TestNPC)
                {
                    gController.TestTargetLocation = (Transform)EditorGUILayout.ObjectField("Test Target Location", (Transform)gController.TestTargetLocation, typeof(Transform), true);
                }
                else
                {
                    gController.TestTargetLocation = null;
                }
            }

            /* Perception */
            gShowPerception = EditorGUILayout.Foldout(gShowPerception, "Perception") && gController.Perception != null;
            if (gShowPerception)
            {
                gController.Perception.ViewAngle = (float)EditorGUILayout.IntSlider(label_ViewAngle, (int)gController.Perception.ViewAngle,
                                                                                    (int)NPCPerception.MIN_VIEW_ANGLE,
                                                                                    (int)NPCPerception.MAX_VIEW_ANGLE);
                gController.Perception.PerceptionRadius = (float)EditorGUILayout.IntSlider(label_PerceptionRadius, (int)gController.Perception.PerceptionRadius,
                                                                                           (int)NPCPerception.MIN_PERCEPTION_FIELD,
                                                                                           (int)NPCPerception.MAX_PERCEPTION_FIELD);
            }

            /* AI */
            gShowAI = EditorGUILayout.Foldout(gShowAI, "AI") && gController.AI != null;
            if (gShowAI)
            {
                if (gController.AI.Pathfinders != null)
                {
                    string[] pfds = new string[gController.AI.Pathfinders.Count];
                    gController.AI.Pathfinders.Keys.CopyTo(pfds, 0);
                    selectedPathfinder = 0;
                    for (int i = 0; i < pfds.Length; ++i)
                    {
                        if (pfds[i] == gController.AI.SelectedPathfinder)
                        {
                            selectedPathfinder = i;
                        }
                    }
                    if (gController.AI.Pathfinders.ContainsKey(pfds[selectedPathfinder]))
                    {
                        selectedPathfinder = EditorGUILayout.Popup("Pathfinders", selectedPathfinder, pfds);
                        gController.AI.SelectedPathfinder = pfds[selectedPathfinder];
                    }
                    else
                    {
                        gController.AI.SelectedPathfinder = pfds[0];
                    }
                    if (gController.Body.Navigation == NAV_STATE.STEERING_NAV)
                    {
                        gController.AI.NavMeshAgentPathfinding = (bool)EditorGUILayout.Toggle(label_NavMeshAgentPathfinding, (bool)gController.AI.NavMeshAgentPathfinding);
                        if (gController.AI.NavMeshAgentPathfinding)
                        {
                            gController.AI.SelectedPathfinder = pfds[0];
                        }
                    }
                    else
                    {
                        gController.AI.NavMeshAgentPathfinding = false;
                    }
                }
            }

            /* Body */
            gShowBody = EditorGUILayout.Foldout(gShowBody, "Body") && gController.Body != null;
            if (gShowBody)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(label_BodyNavigation);
                gController.Body.Navigation = (NAV_STATE)EditorGUILayout.EnumPopup((NAV_STATE)gController.Body.Navigation);
                EditorGUILayout.EndHorizontal();
                if (gController.Body.Navigation != NAV_STATE.DISABLED)
                {
                    gController.Body.NavDistanceThreshold = (float)EditorGUILayout.FloatField(label_NavStoppingThresh, (float)gController.Body.NavDistanceThreshold);
                }
                gController.Body.IKEnabled = (bool)EditorGUILayout.Toggle(label_IKEnabled, (bool)gController.Body.IKEnabled);
                if (gController.Body.IKEnabled)
                {
                    gController.Body.IK_USE_HINTS    = (bool)EditorGUILayout.Toggle(label_IKUseHints, (bool)gController.Body.IK_USE_HINTS);
                    gController.Body.IK_FEET_Enabled = (bool)EditorGUILayout.Toggle(label_IKFeetEnabled, (bool)gController.Body.IK_FEET_Enabled);
                    if (gController.Body.IK_FEET_Enabled)
                    {
                        gController.Body.IK_LOOK_AT_SMOOTH                 = (float)EditorGUILayout.Slider(label_IKLookSmoothness, gController.Body.IK_LOOK_AT_SMOOTH, 1f, 10f);
                        gController.Body.IK_FEET_HEIGHT_CORRECTION         = (float)EditorGUILayout.Slider(label_IKFeetHeight, gController.Body.IK_FEET_HEIGHT_CORRECTION, 0f, 0.5f);
                        gController.Body.IK_FEET_FORWARD_CORRECTION        = (float)EditorGUILayout.Slider(label_IKFeetForward, gController.Body.IK_FEET_FORWARD_CORRECTION, -0.5f, 0.5f);
                        gController.Body.IK_FEET_HEIGHT_EFFECTOR_CORRECTOR = (float)EditorGUILayout.Slider(label_IKFeetEffectorCorrector, gController.Body.IK_FEET_HEIGHT_EFFECTOR_CORRECTOR, 0f, 0.3f);
                        gController.Body.IK_FEET_STAIRS_INTERPOLATION      = (float)EditorGUILayout.Slider(label_IKFeetStairsInt, gController.Body.IK_FEET_STAIRS_INTERPOLATION, 0f, 20f);
                    }
                }
                gController.Body.StepHeight            = (float)EditorGUILayout.FloatField(label_StepHeight, (float)gController.Body.StepHeight);
                gController.Body.UseAnimatorController = (bool)EditorGUILayout.Toggle(label_AnimatorEnabled, (bool)gController.Body.UseAnimatorController);
                gController.Body.UseCurves             = (bool)EditorGUILayout.Toggle(label_UseAnimCurves, (bool)gController.Body.UseCurves);
                gController.Body.EnableSocialForces    = (bool)EditorGUILayout.Toggle(label_UseSocialForces, (bool)gController.Body.EnableSocialForces);
                if (gController.Body.EnableSocialForces)
                {
                    gController.Body.AgentRepulsionWeight = (float)EditorGUILayout.FloatField(label_AgentRepulsionWeight, (float)gController.Body.AgentRepulsionWeight);
                    gController.Body.DistanceTolerance    = (float)EditorGUILayout.FloatField(label_AgentRepulsionDistanceTolerance, (float)gController.Body.DistanceTolerance);
                }
            }

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(gController, "Parameter Changed");
                EditorUtility.SetDirty(gController);
            }
        }
Example #12
0
        private static bool FloatField(string name, ref float value, bool hidden, bool greyedOut, GUILayoutOption opt)
        {
            float newValue = value;

            GUI.changed = false;

            if (!hidden)
            {
                if (greyedOut)
                {
                    GUI.color = new Color(0.7f, 0.7f, 0.7f);
                    newValue  = EditorGUILayout.FloatField(name, newValue, opt);
                    GUI.color = Color.white;
                }
                else
                {
                    newValue = EditorGUILayout.FloatField(name, newValue, opt);
                }
            }
            else if (greyedOut)
            {
                GUI.color = new Color(0.7f, 0.7f, 0.7f);
                float.TryParse(EditorGUILayout.TextField(name, "--", opt), out newValue);
                GUI.color = Color.white;
            }
            else
            {
                float.TryParse(EditorGUILayout.TextField(name, "--", opt), out newValue);
            }

            if (GUI.changed && Differs(newValue, value))
            {
                value = newValue;
                return(true);
            }
            return(false);
        }
    private void OnGUI()
    {
        EditorGUILayout.BeginVertical();
        {
            {
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("Copy To Clipboard", GUILayout.Width(180)))
                {
                    EditorGUIUtility.systemCopyBuffer = PluginVersionsString();
                    GUI.FocusControl("");
                }
                if (GUILayout.Button("Reload", GUILayout.Width(80)))
                {
                    Reload();
                    GUI.FocusControl("");
                }
                EditorGUILayout.EndHorizontal();
            }
            /* スクリプトバージョン表示 */
            {
                EditorGUILayout.LabelField("Script Version");
                EditorGUI.indentLevel++;
                EditorGUILayout.LabelField("Ver." + CriWare.GetScriptVersionString());
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.Space();
            /* バイナリバージョン表示 */
            {
                EditorGUILayout.LabelField("Binary Version");
            }
            EditorGUI.indentLevel++;
            /* プラットフォーム別プラグインバイナリバージョン表示 */
            {
                EditorGUILayout.BeginVertical();
                GUILayoutOption platformColumnWidth  = GUILayout.Width(80);
                GUILayoutOption targetColumnWidth    = GUILayout.Width(120);
                GUILayoutOption versionColumnWidth   = GUILayout.Width(140);
                GUILayoutOption buildDateColumnWidth = GUILayout.Width(200);
                GUILayoutOption appendixColumnWidth  = GUILayout.Width(200);
                GUILayoutOption pathColumnWidth      = GUILayout.Width(400);
                if (pluginInfos != null)
                {
                    foreach (var info in pluginInfos)
                    {
                        EditorGUILayout.BeginHorizontal();
                        {
                            if (GUILayout.Button(info.platform, EditorStyles.radioButton, platformColumnWidth))
                            {
                                /* 表示の制限のため表示可能な文字数で切り出す */
                                detailVersionsString  = ModuleInfosToAlignedString(info.moduleVersionInfos);
                                detailVersionsStrings = SplitTextAreaMaxLength(detailVersionsString);
                                scrollPosition        = new Vector2(0.0f, 0.0f);
                                GUI.FocusControl("");
                            }

                            if (info.info != null)
                            {
                                EditorGUILayout.LabelField((info.target ?? "--"), targetColumnWidth);
                                EditorGUILayout.LabelField((info.info.version ?? "--"), versionColumnWidth);
                                EditorGUILayout.LabelField((info.info.buildDate ?? "--"), buildDateColumnWidth);
                                EditorGUILayout.LabelField((info.info.appendix ?? "--"), appendixColumnWidth);
                            }
                            else
                            {
                                EditorGUILayout.LabelField("--", targetColumnWidth);
                                EditorGUILayout.LabelField("--", versionColumnWidth);
                                EditorGUILayout.LabelField("--", buildDateColumnWidth);
                                EditorGUILayout.LabelField("--", appendixColumnWidth);
                            }

                            EditorGUILayout.LabelField(info.path, pathColumnWidth);
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUI.indentLevel--;
            /* 詳細バージョン情報表示 */
            {
                if (GUILayout.Button("Copy Detail To Clipboard", GUILayout.Width(180)))
                {
                    EditorGUIUtility.systemCopyBuffer = detailVersionsString;
                    GUI.FocusControl("");
                }
                scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
                EditorGUILayout.BeginVertical();
                foreach (var item in detailVersionsStrings)
                {
                    EditorGUILayout.TextArea(item);
                }
                EditorGUILayout.EndVertical();
                EditorGUILayout.EndScrollView();
            }
        }
        EditorGUILayout.EndVertical();
    }
Example #14
0
 public int DoGUI(ChartType type, int selectedFrame, ChartData cdata, ProfilerArea area, bool active, GUIContent icon, out ChartAction action)
 {
     action = ChartAction.None;
     if (cdata != null)
     {
         int numberOfFrames = cdata.NumberOfFrames;
         if (ms_Styles == null)
         {
             ms_Styles = new Styles();
         }
         this.m_chartControlID = GUIUtility.GetControlID(s_ChartHash, FocusType.Keyboard);
         GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinHeight(120f) };
         Rect rect       = GUILayoutUtility.GetRect(GUIContent.none, ms_Styles.background, options);
         Rect chartFrame = rect;
         chartFrame.x     += 170f;
         chartFrame.width -= 170f;
         Event current = Event.current;
         if ((current.GetTypeForControl(this.m_chartControlID) == EventType.MouseDown) && rect.Contains(current.mousePosition))
         {
             action = ChartAction.Activated;
         }
         if (this.m_DragItemIndex == -1)
         {
             selectedFrame = this.HandleFrameSelectionEvents(selectedFrame, this.m_chartControlID, chartFrame, cdata, numberOfFrames);
         }
         Rect position = chartFrame;
         position.x    -= 170f;
         position.width = 170f;
         GUI.Label(new Rect(position.x, position.y, position.width, 20f), GUIContent.Temp("", icon.tooltip));
         if (current.type == EventType.Repaint)
         {
             ms_Styles.rightPane.Draw(chartFrame, false, false, active, false);
             ms_Styles.leftPane.Draw(position, EditorGUIUtility.TempContent(icon.text), false, false, active, false);
             if (this.m_NotSupportedWarning == null)
             {
                 chartFrame.height--;
                 if (type == ChartType.StackedFill)
                 {
                     this.DrawChartStacked(selectedFrame, cdata, chartFrame);
                 }
                 else
                 {
                     this.DrawChartLine(selectedFrame, cdata, chartFrame);
                 }
             }
             else
             {
                 Rect rect4 = chartFrame;
                 rect4.x += 56.1f;
                 rect4.y += 43f;
                 GUI.Label(rect4, this.m_NotSupportedWarning, EditorStyles.boldLabel);
             }
             position.x += 10f;
             position.y += 10f;
             GUIStyle.none.Draw(position, EditorGUIUtility.TempContent(icon.image), false, false, false, false);
             position.x += 40f;
             this.DrawLabelDragger(type, position, cdata);
         }
         else
         {
             position.y += 10f;
             this.LabelDraggerDrag(this.m_chartControlID, type, cdata, position, active);
         }
         if (area == ProfilerArea.GPU)
         {
             GUI.Label(new Rect((rect.x + 170f) - ms_Styles.performanceWarning.image.width, (rect.yMax - ms_Styles.performanceWarning.image.height) - 2f, (float)ms_Styles.performanceWarning.image.width, (float)ms_Styles.performanceWarning.image.height), ms_Styles.performanceWarning);
         }
         if (GUI.Button(new Rect(((rect.x + 170f) - 13f) - 2f, rect.y + 2f, 13f, 13f), GUIContent.none, ms_Styles.closeButton))
         {
             action = ChartAction.Closed;
         }
     }
     return(selectedFrame);
 }
        private void DrawFileChanges()
        {
            var size   = EditorGUIUtility.singleLineHeight;
            var square = new GUILayoutOption[] {
                GUILayout.MinWidth(size), GUILayout.MinHeight(size),
                GUILayout.MaxWidth(size), GUILayout.MaxHeight(size)
            };
            var button = new GUILayoutOption[] {
                GUILayout.MinWidth(size * 2 - 4), GUILayout.MinHeight(size - 2),
                GUILayout.MaxWidth(size * 2 - 4), GUILayout.MaxHeight(size - 2)
            };

            EditorGUILayout.BeginHorizontal();
            all = EditorGUILayout.Toggle(all, square);
            var newAll = all;

            EditorGUILayout.LabelField(GUIContent.none, square);
            var oldFontStyle = GUI.skin.label.fontStyle;

            GUI.skin.label.fontStyle = FontStyle.Bold;
            GUILayout.Label("Path");
            GUI.skin.label.fontStyle = oldFontStyle;
            EditorGUILayout.EndHorizontal();

            // Remove toggle entries for files that are no longer changed
            var toRemove = new List <string>();

            toggled = toggled ?? new ToggledDictionary();
            foreach (var file in toggled.Dictionary.Keys)
            {
                if (!State.Files.Select(x => x.FilePath).Contains(file))
                {
                    toRemove.Add(file);
                }
            }
            foreach (var file in toRemove)
            {
                toggled.Dictionary.Remove(file);
            }

            foreach (var file in State.Files)
            {
                EditorGUILayout.BeginHorizontal();

                // Draw toggle
                if (all)
                {
                    newAll = EditorGUILayout.Toggle(all, square);
                }
                else
                {
                    if (!toggled.Dictionary.ContainsKey(file.FilePath))
                    {
                        toggled[file.FilePath] = false;
                    }
                    toggled[file.FilePath] =
                        EditorGUILayout.Toggle(toggled[file.FilePath], square);
                }

                // Draw change type image
                switch (file.State)
                {
                case FileStatus.DeletedFromIndex:
                case FileStatus.DeletedFromWorkdir:
                    GUILayout.Label(Content(ImageCache.Deleted, "This file has been deleted."), square);
                    break;

                case FileStatus.ModifiedInIndex:
                case FileStatus.ModifiedInWorkdir:
                case FileStatus.RenamedInIndex:
                case FileStatus.RenamedInWorkdir:
                case FileStatus.TypeChangeInIndex:
                case FileStatus.TypeChangeInWorkdir:
                    GUILayout.Label(Content(ImageCache.Modified, "This file has been modified."), square);
                    break;

                case FileStatus.NewInIndex:
                case FileStatus.NewInWorkdir:
                    GUILayout.Label(Content(ImageCache.Added, "This file has been added."), square);
                    break;

                case FileStatus.Ignored:
                    GUI.enabled = false;
                    break;
                }

                // Draw file label
                EditorGUILayout.LabelField(file.FilePath);

                EditorGUILayout.Space();

                if (GUILayout.Button(Content(ImageCache.X, "Discard Changes"), button))
                {
                    var msg = "Are you sure you want to discard the changes to " + file.FilePath + "?";
                    if (EditorUtility.DisplayDialog("Discard Changes?", msg, "Yes", "No"))
                    {
                        CheckoutFile(file.FilePath);
                    }
                }
                GUI.enabled = true;

                EditorGUILayout.EndHorizontal();
            }

            if (newAll != all)
            {
                all = newAll;
            }
        }
Example #16
0
        public static void DoGUI(string title, ref bool show, ref Vector2 scrollPos, GetValueFunc getValue, SetValueFunc setValue)
        {
            int num5 = 0;

            for (int i = 0; i < 0x20; i++)
            {
                if (LayerMask.LayerToName(i) != string.Empty)
                {
                    num5++;
                }
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(0f);
            show = EditorGUILayout.Foldout(show, title);
            GUILayout.EndHorizontal();
            if (show)
            {
                GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinHeight(120f), GUILayout.MaxHeight((float)(100 + ((num5 + 1) * 0x10))) };
                scrollPos = GUILayout.BeginScrollView(scrollPos, options);
                Rect    rect        = GUILayoutUtility.GetRect((float)((0x10 * num5) + 100), 100f);
                Rect    topmostRect = GUIClip.topmostRect;
                Vector2 vector      = GUIClip.Unclip(new Vector2(rect.x, rect.y));
                int     num7        = 0;
                for (int j = 0; j < 0x20; j++)
                {
                    if (LayerMask.LayerToName(j) != string.Empty)
                    {
                        float num9 = (130 + ((num5 - num7) * 0x10)) - (topmostRect.width + scrollPos.x);
                        if (num9 < 0f)
                        {
                            num9 = 0f;
                        }
                        Vector3 pos = new Vector3(((((130 + (0x10 * (num5 - num7))) + vector.y) + vector.x) + scrollPos.y) - num9, vector.y + scrollPos.y, 0f);
                        GUI.matrix = Matrix4x4.TRS(pos, Quaternion.identity, Vector3.one) * Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0f, 0f, 90f), Vector3.one);
                        if (SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 9.0"))
                        {
                            GUI.matrix *= Matrix4x4.TRS(new Vector3(-0.5f, -0.5f, 0f), Quaternion.identity, Vector3.one);
                        }
                        GUI.Label(new Rect((2f - vector.x) - scrollPos.y, scrollPos.y - num9, 100f, 16f), LayerMask.LayerToName(j), "RightLabel");
                        num7++;
                    }
                }
                GUI.matrix = Matrix4x4.identity;
                num7       = 0;
                for (int k = 0; k < 0x20; k++)
                {
                    if (LayerMask.LayerToName(k) != string.Empty)
                    {
                        int  num11 = 0;
                        Rect rect3 = GUILayoutUtility.GetRect((float)((30 + (0x10 * num5)) + 100), 16f);
                        GUI.Label(new Rect(rect3.x + 30f, rect3.y, 100f, 16f), LayerMask.LayerToName(k), "RightLabel");
                        for (int m = 0x1f; m >= 0; m--)
                        {
                            if (LayerMask.LayerToName(m) != string.Empty)
                            {
                                if (num11 < (num5 - num7))
                                {
                                    GUIContent content = new GUIContent(string.Empty, LayerMask.LayerToName(k) + "/" + LayerMask.LayerToName(m));
                                    bool       flag    = getValue(k, m);
                                    bool       val     = GUI.Toggle(new Rect((130f + rect3.x) + (num11 * 0x10), rect3.y, 16f, 16f), flag, content);
                                    if (val != flag)
                                    {
                                        setValue(k, m, val);
                                    }
                                }
                                num11++;
                            }
                        }
                        num7++;
                    }
                }
                GUILayout.EndScrollView();
            }
        }
		public static float HorizontalSlider(float value, float leftValue, float rightValue, GUIStyle slider, GUIStyle thumb, GUILayoutOption[] options){}
Example #18
0
 private void Awake()
 {
     _target       = target as IntEvent;
     _buttonHeight = GUILayout.Height(75);
 }
		private static float DoVerticalSlider(float value, float leftValue, float rightValue, GUIStyle slider, GUIStyle thumb, GUILayoutOption[] options){}
    private static void Draw(BaseData[] showInInspectorDatas)
    {
        GUILayoutOption[] emptyOptions = new GUILayoutOption[0];

        EditorGUILayout.BeginVertical(emptyOptions);

        foreach (BaseData field in showInInspectorDatas)
        {
            EditorGUILayout.BeginHorizontal(emptyOptions);
            EditorGUI.BeginDisabledGroup(!field.hasSetter);

            switch (field.inspectorType)
            {
            case SerializedPropertyType.Integer:
                field.SetValue(EditorGUILayout.IntField(field.name, (int)field.GetValue()));
                break;

            case SerializedPropertyType.Float:
                field.SetValue(EditorGUILayout.FloatField(field.name, (float)field.GetValue()));
                break;

            case SerializedPropertyType.Boolean:
                field.SetValue(EditorGUILayout.Toggle(field.name, (bool)field.GetValue()));
                break;

            case SerializedPropertyType.String:
                field.SetValue(EditorGUILayout.TextField(field.name, (String)field.GetValue()));
                break;

            case SerializedPropertyType.Color:
                field.SetValue(EditorGUILayout.ColorField(field.name, (Color)field.GetValue()));
                break;

            case SerializedPropertyType.ObjectReference:
                var objRef = field.GetValue();
                field.SetValue(EditorGUILayout.ObjectField(field.name, (Object)objRef, objRef.GetType(), true));
                break;

            case SerializedPropertyType.LayerMask:
                field.SetValue(EditorGUILayout.LayerField(field.name, (LayerMask)field.GetValue()));
                break;

            case SerializedPropertyType.Enum:
                field.SetValue(EditorGUILayout.EnumPopup(field.name, (Enum)field.GetValue()));
                break;

            case SerializedPropertyType.Vector2:
                field.SetValue(EditorGUILayout.Vector2Field(field.name, (Vector2)field.GetValue()));
                break;

            case SerializedPropertyType.Vector3:
                field.SetValue(EditorGUILayout.Vector3Field(field.name, (Vector3)field.GetValue()));
                break;

            case SerializedPropertyType.AnimationCurve:
                field.SetValue(EditorGUILayout.CurveField(field.name, (AnimationCurve)field.GetValue()));
                break;

            case SerializedPropertyType.Bounds:
                field.SetValue(EditorGUILayout.BoundsField(field.name, (Bounds)field.GetValue()));
                break;

                // Haven't been able to get Gradients to work since the Editor for Gradients rely on SerializedProperty, todo: create my own gradient editor...
                //case SerializedPropertyType.Gradient:
                //    field.SetValue(GradientField(field.name, (Gradient)field.GetValue()));
                //    break;

#if hasSerializedPropertyTypeQuaternion
            case SerializedPropertyType.Quaternion:
                Vector3 eulerAngles = ((Quaternion)field.GetValue()).eulerAngles;
                field.SetValue(Quaternion.Euler(EditorGUILayout.Vector3Field(field.name, eulerAngles)));
                break;
#endif

            case SerializedPropertyType.Rect:
                field.SetValue(EditorGUILayout.RectField(field.name, (Rect)field.GetValue()));
                break;


            default:
                Debug.LogError("ShowInInspector: Failed drawing " + field.name + ", " + field.instance);
                break;
            }

            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndHorizontal();
        }

        EditorGUILayout.EndVertical();
    }
		public static void BeginHorizontal(string text, GUIStyle style, GUILayoutOption[] options){}
Example #22
0
        internal static void Layout()
        {
            var fixedWidth = new GUILayoutOption[1] {
                GUILayout.ExpandWidth(false)
            };

            GUILayout.Label("<b><color=cyan>Descriptions can have multiple lines and paragraphs.</color></b>", fixedWidth);

            uint locationNumber = 1;

            foreach (var location in GlobalMapLocations)
            {
                if (location.IsDeleted)
                {
                    continue;
                }

                GUILayout.Space(10f);

                string locationLabel = $"{locationNumber++}: { location.Name ?? location.Notes }";
                if (location.IsVisible)
                {
                    locationLabel = $"<color=#1aff1a><b>{locationLabel}</b></color>";
                }
                GUILayout.Label(locationLabel, fixedWidth);

                GUILayout.BeginHorizontal();
                GUILayout.Label("Notes: ", fixedWidth);
                location.Notes = GUILayout.TextArea(location.Notes, GUILayout.MaxWidth(500f));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Color: ", fixedWidth);
                for (int i = 0; i < ColorNames.Length; i++)
                {
                    if (GUILayout.Toggle(location.Color == Colors[i], ColorNames[i], fixedWidth))
                    {
                        location.Color = Colors[i];
                    }
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                if (GUILayout.Button(location.IsVisible ? "Hide" : "Show", fixedWidth))
                {
                    location.IsVisible = !location.IsVisible;
                }
                if (!location.IsBeingDeleted && GUILayout.Button("Delete", fixedWidth))
                {
                    location.IsBeingDeleted = true;
                }
                if (location.IsBeingDeleted)
                {
                    GUILayout.Label("Are you sure?", fixedWidth);
                    if (GUILayout.Button("Yes", fixedWidth))
                    {
                        location.IsDeleted = true;
                        location.IsVisible = false;
                    }
                    if (GUILayout.Button("No", fixedWidth))
                    {
                        location.IsBeingDeleted = false;
                    }
                }
                GUILayout.EndHorizontal();
            }
        }
		public static void BeginVertical(Texture image, GUIStyle style, GUILayoutOption[] options){}
Example #24
0
        public override void OnInspectorGUI()
        {
            GUI.changed = false;
            EditorGUILayout.LabelField("IOS Deploy Settings", EditorStyles.boldLabel);
            EditorGUILayout.Space();


            GUI.SetNextControlName("toolbar");

            GUILayoutOption[] toolbarSize = new GUILayoutOption[] { GUILayout.Width(Width - 10), GUILayout.Height(35) };
            ISD_Settings.Instance.ToolbarIndex = GUILayout.Toolbar(ISD_Settings.Instance.ToolbarIndex, ToolbarImages, toolbarSize);



#if DISABLED
            GUI.enabled = false;
#endif
            EditorGUILayout.Space();
            switch (ISD_Settings.Instance.ToolbarIndex)
            {
            case 0:
                //"Build Settings"
                BuildSettings();
                break;

            case 1:
                Frameworks();
                break;

            case 2:
                Library();
                break;

            case 3:
                Flags();
                break;

            case 4:
                PlistValues();
                break;

            case 5:
                LanguageValues();
                break;

            case 6:

                break;

            default:

                break;
            }

            EditorGUILayout.Space();
            //GUILayout.FlexibleSpace();
            AboutGUI();


            if (GUI.changed)
            {
                DirtyEditor();
            }
        }
		public static Rect GetRect(GUIContent content, GUIStyle style, GUILayoutOption[] options){}
Example #26
0
    /****************************************************************************************************/
    private void CreateControlSetupGUI()
    {
        GUILayoutOption scrollViewWidth    = GUILayout.Width(240);
        GUILayoutOption scrollViewBtnWidth = GUILayout.Width(242);
        GUILayoutOption scrollViewHeight   = GUILayout.Height(200);

        EditorGUILayout.BeginVertical();
        {
            EditorGUILayout.LabelField("Step 1: Control Setup", titleStyle, GUILayout.ExpandHeight(true));
            if (GUILayout.Button("Get Selected Scene Objects", GUILayout.Width(494)))
            {
                InitSelectControlList();
                sortSelectControl      = false;
                selectControlSelectAll = false;
            }
            CreateSpace(1);
            EditorGUILayout.BeginHorizontal(GUILayout.Width(500));
            {
                EditorGUILayout.BeginVertical();
                {
                    EditorGUILayout.LabelField("Selected Objects:", headingStyle);
                    if (GUILayout.Button("Add Controls", scrollViewBtnWidth))
                    {
                        AddControls();
                        sceneControlObjectList = LiveUnityInterface.GetControls(charSetupData.GetControlList());
                        sortAddedControl       = false;
                        addedControlSelectAll  = false;
                    }
                    bool checkSelectAll;
                    bool checkSort;
                    EditorGUILayout.BeginHorizontal();
                    {
                        checkSelectAll = GUILayout.Toggle(selectControlSelectAll, "Select All");
                        checkSort      = GUILayout.Toggle(sortSelectControl, "Sort A-Z");
                    }
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal(scrollviewBgStyle, GUILayout.Width(200));
                    {
                        selectedControlScrollPos = EditorGUILayout.BeginScrollView(selectedControlScrollPos, false, false, scrollViewWidth, scrollViewHeight);
                        PopulateControlScrollView(controlSelection, selectControlSelectAll != checkSelectAll, checkSelectAll, checkSort);
                        EditorGUILayout.EndScrollView();
                    }
                    EditorGUILayout.EndHorizontal();

                    sortSelectControl      = checkSort;
                    selectControlSelectAll = checkSelectAll;
                }
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical();
                {
                    EditorGUILayout.LabelField("Added Controls:", headingStyle);
                    if (GUILayout.Button("Remove Controls", scrollViewBtnWidth))
                    {
                        RemoveControls();
                        sceneControlObjectList = LiveUnityInterface.GetControls(charSetupData.GetControlList());
                    }
                    bool checkSelectAll;
                    bool checkSort;
                    EditorGUILayout.BeginHorizontal();
                    {
                        checkSelectAll = GUILayout.Toggle(addedControlSelectAll, "Select All");
                        checkSort      = GUILayout.Toggle(sortAddedControl, "Sort A-Z");
                    }
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal(scrollviewBgStyle, GUILayout.Width(200));
                    {
                        addedControlScrollPos = EditorGUILayout.BeginScrollView(addedControlScrollPos, false, false, scrollViewWidth, scrollViewHeight);
                        PopulateControlScrollView(addedControls, addedControlSelectAll != checkSelectAll, checkSelectAll, checkSort);
                        EditorGUILayout.EndScrollView();
                    }
                    EditorGUILayout.EndHorizontal();

                    sortAddedControl      = checkSort;
                    addedControlSelectAll = checkSelectAll;
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndVertical();
        CreateSpace(2);
    }
		private static Rect DoGetRect(float minWidth, float maxWidth, float minHeight, float maxHeight, GUIStyle style, GUILayoutOption[] options){}
		public static int Toolbar(int selected, GUIContent[] contents, GUIStyle style, GUILayoutOption[] options){}
Example #29
0
    bool OnGUIUserInfo()
    {
        bool updatedContent = false;

        if (!RemoteConfig.IsInitialized())
        {
            RemoteConfig.Init();
        }

        if (APIUser.IsLoggedInWithCredentials && uploadedWorlds != null && uploadedAvatars != null)
        {
            bool expandedLayout = false; // (position.width > MAX_ALL_INFORMATION_WIDTH);    // uncomment for future wide layouts

            if (!expandedLayout)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
            }

            GUILayout.BeginHorizontal();

            GUILayout.BeginVertical(searchBarStyle);

            EditorGUILayout.BeginHorizontal();

            float           searchFieldShrinkOffset = 30f;
            GUILayoutOption layoutOption            = (expandedLayout ? GUILayout.Width(position.width - searchFieldShrinkOffset) : GUILayout.Width(SdkWindowWidth - searchFieldShrinkOffset));
            searchString = EditorGUILayout.TextField(searchString, GUI.skin.FindStyle("SearchTextField"), layoutOption);
            GUIStyle searchButtonStyle = searchString == string.Empty
                ? GUI.skin.FindStyle("SearchCancelButtonEmpty")
                : GUI.skin.FindStyle("SearchCancelButton");
            if (GUILayout.Button(string.Empty, searchButtonStyle))
            {
                searchString = string.Empty;
                GUI.FocusControl(null);
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();

            if (!expandedLayout)
            {
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
            }

            layoutOption     = (expandedLayout ? GUILayout.Width(position.width) : GUILayout.Width(SdkWindowWidth));
            contentScrollPos = EditorGUILayout.BeginScrollView(contentScrollPos, layoutOption);

            GUIStyle descriptionStyle = new GUIStyle(EditorStyles.wordWrappedLabel);
            descriptionStyle.wordWrap = true;

            if (uploadedWorlds.Count > 0)
            {
                EditorGUILayout.Space();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("WORLDS", EditorStyles.boldLabel, GUILayout.ExpandWidth(false), GUILayout.Width(58));
                WorldsToggle = EditorGUILayout.Foldout(WorldsToggle, new GUIContent(""));
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.Space();

                if (WorldsToggle)
                {
                    List <ApiWorld> tmpWorlds = new List <ApiWorld>();

                    if (uploadedWorlds.Count > 0)
                    {
                        tmpWorlds = new List <ApiWorld>(uploadedWorlds);
                    }

                    foreach (ApiWorld w in tmpWorlds)
                    {
                        if (justDeletedContents != null && justDeletedContents.Contains(w.id))
                        {
                            uploadedWorlds.Remove(w);
                            continue;
                        }

                        if (!w.name.ToLowerInvariant().Contains(searchString.ToLowerInvariant()))
                        {
                            continue;
                        }

                        EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                        EditorGUILayout.BeginHorizontal(GUILayout.Width(WORLD_IMAGE_BUTTON_WIDTH));

                        if (ImageCache.ContainsKey(w.id))
                        {
                            if (GUILayout.Button(ImageCache[w.id], GUILayout.Height(WORLD_IMAGE_BUTTON_HEIGHT),
                                                 GUILayout.Width(WORLD_IMAGE_BUTTON_WIDTH)))
                            {
                                Application.OpenURL(w.imageUrl);
                            }
                        }
                        else
                        {
                            if (GUILayout.Button("", GUILayout.Height(WORLD_IMAGE_BUTTON_HEIGHT),
                                                 GUILayout.Width(WORLD_IMAGE_BUTTON_WIDTH)))
                            {
                                Application.OpenURL(w.imageUrl);
                            }
                        }

                        if (expandedLayout)
                        {
                            EditorGUILayout.BeginHorizontal();
                            EditorGUILayout.LabelField(w.name, descriptionStyle,
                                                       GUILayout.Width(position.width - MAX_ALL_INFORMATION_WIDTH +
                                                                       WORLD_DESCRIPTION_FIELD_WIDTH));
                        }
                        else
                        {
                            EditorGUILayout.BeginVertical();
                            EditorGUILayout.LabelField(w.name, descriptionStyle);
                        }

                        EditorGUILayout.LabelField("Release Status: " + w.releaseStatus,
                                                   GUILayout.Width(WORLD_RELEASE_STATUS_FIELD_WIDTH));
                        if (GUILayout.Button("Copy ID", GUILayout.Width(COPY_WORLD_ID_BUTTON_WIDTH)))
                        {
                            TextEditor te = new TextEditor();
                            te.text = w.id;
                            te.SelectAll();
                            te.Copy();
                        }

                        if (GUILayout.Button("Delete", GUILayout.Width(DELETE_WORLD_BUTTON_WIDTH)))
                        {
                            if (EditorUtility.DisplayDialog("Delete " + w.name + "?",
                                                            "Are you sure you want to delete " + w.name + "? This cannot be undone.", "Delete",
                                                            "Cancel"))
                            {
                                foreach (VRC.Core.PipelineManager pm in FindObjectsOfType <VRC.Core.PipelineManager>()
                                         .Where(pm => pm.blueprintId == w.id))
                                {
                                    pm.blueprintId          = "";
                                    pm.completedSDKPipeline = false;

                                    UnityEditor.EditorUtility.SetDirty(pm);
                                    UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(pm.gameObject.scene);
                                    UnityEditor.SceneManagement.EditorSceneManager.SaveScene(pm.gameObject.scene);
                                }

                                API.Delete <ApiWorld>(w.id);
                                uploadedWorlds.RemoveAll(world => world.id == w.id);
                                if (ImageCache.ContainsKey(w.id))
                                {
                                    ImageCache.Remove(w.id);
                                }

                                if (justDeletedContents == null)
                                {
                                    justDeletedContents = new List <string>();
                                }
                                justDeletedContents.Add(w.id);
                                updatedContent = true;
                            }
                        }

                        if (expandedLayout)
                        {
                            EditorGUILayout.EndHorizontal();
                        }
                        else
                        {
                            EditorGUILayout.EndVertical();
                        }
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.Space();
                    }
                }
            }

            if (uploadedAvatars.Count > 0)
            {
                EditorGUILayout.Space();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("AVATARS", EditorStyles.boldLabel, GUILayout.ExpandWidth(false), GUILayout.Width(65));
                AvatarsToggle = EditorGUILayout.Foldout(AvatarsToggle, new GUIContent(""));
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.Space();

                if (AvatarsToggle)
                {
                    List <ApiAvatar> tmpAvatars = new List <ApiAvatar>();

                    if (uploadedAvatars.Count > 0)
                    {
                        tmpAvatars = new List <ApiAvatar>(uploadedAvatars);
                    }

                    if (justUpdatedAvatars != null)
                    {
                        foreach (ApiAvatar a in justUpdatedAvatars)
                        {
                            int index = tmpAvatars.FindIndex((av) => av.id == a.id);
                            if (index != -1)
                            {
                                tmpAvatars[index] = a;
                            }
                        }
                    }

                    foreach (ApiAvatar a in tmpAvatars)
                    {
                        if (justDeletedContents != null && justDeletedContents.Contains(a.id))
                        {
                            uploadedAvatars.Remove(a);
                            continue;
                        }

                        if (!a.name.ToLowerInvariant().Contains(searchString.ToLowerInvariant()))
                        {
                            continue;
                        }

                        EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                        EditorGUILayout.BeginHorizontal(GUILayout.Width(AVATAR_DESCRIPTION_FIELD_WIDTH));
                        if (ImageCache.ContainsKey(a.id))
                        {
                            if (GUILayout.Button(ImageCache[a.id], GUILayout.Height(AVATAR_IMAGE_BUTTON_HEIGHT),
                                                 GUILayout.Width(AVATAR_IMAGE_BUTTON_WIDTH)))
                            {
                                Application.OpenURL(a.imageUrl);
                            }
                        }
                        else
                        {
                            if (GUILayout.Button("", GUILayout.Height(AVATAR_IMAGE_BUTTON_HEIGHT),
                                                 GUILayout.Width(AVATAR_IMAGE_BUTTON_WIDTH)))
                            {
                                Application.OpenURL(a.imageUrl);
                            }
                        }

                        if (expandedLayout)
                        {
                            EditorGUILayout.BeginHorizontal();
                        }
                        else
                        {
                            EditorGUILayout.BeginVertical();
                        }

                        EditorGUILayout.LabelField(a.name, descriptionStyle,
                                                   GUILayout.Width(expandedLayout
                                ? position.width - MAX_ALL_INFORMATION_WIDTH + AVATAR_DESCRIPTION_FIELD_WIDTH
                                : AVATAR_DESCRIPTION_FIELD_WIDTH));
                        EditorGUILayout.LabelField("Release Status: " + a.releaseStatus,
                                                   GUILayout.Width(AVATAR_RELEASE_STATUS_FIELD_WIDTH));

                        string oppositeReleaseStatus = a.releaseStatus == "public" ? "private" : "public";
                        if (GUILayout.Button("Make " + oppositeReleaseStatus,
                                             GUILayout.Width(SET_AVATAR_STATUS_BUTTON_WIDTH)))
                        {
                            a.releaseStatus = oppositeReleaseStatus;

                            a.SaveReleaseStatus((c) =>
                            {
                                ApiAvatar savedBP = (ApiAvatar)c.Model;

                                if (justUpdatedAvatars == null)
                                {
                                    justUpdatedAvatars = new List <ApiAvatar>();
                                }
                                justUpdatedAvatars.Add(savedBP);
                            },
                                                (c) =>
                            {
                                Debug.LogError(c.Error);
                                EditorUtility.DisplayDialog("Avatar Updated",
                                                            "Failed to change avatar release status", "OK");
                            });
                        }

                        if (GUILayout.Button("Copy ID", GUILayout.Width(COPY_AVATAR_ID_BUTTON_WIDTH)))
                        {
                            TextEditor te = new TextEditor();
                            te.text = a.id;
                            te.SelectAll();
                            te.Copy();
                        }

                        if (GUILayout.Button("Delete", GUILayout.Width(DELETE_AVATAR_BUTTON_WIDTH)))
                        {
                            if (EditorUtility.DisplayDialog("Delete " + a.name + "?",
                                                            "Are you sure you want to delete " + a.name + "? This cannot be undone.", "Delete",
                                                            "Cancel"))
                            {
                                foreach (VRC.Core.PipelineManager pm in FindObjectsOfType <VRC.Core.PipelineManager>()
                                         .Where(pm => pm.blueprintId == a.id))
                                {
                                    pm.blueprintId          = "";
                                    pm.completedSDKPipeline = false;

                                    UnityEditor.EditorUtility.SetDirty(pm);
                                    UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(pm.gameObject.scene);
                                    UnityEditor.SceneManagement.EditorSceneManager.SaveScene(pm.gameObject.scene);
                                }

                                API.Delete <ApiAvatar>(a.id);
                                uploadedAvatars.RemoveAll(avatar => avatar.id == a.id);
                                if (ImageCache.ContainsKey(a.id))
                                {
                                    ImageCache.Remove(a.id);
                                }

                                if (justDeletedContents == null)
                                {
                                    justDeletedContents = new List <string>();
                                }
                                justDeletedContents.Add(a.id);
                                updatedContent = true;
                            }
                        }

                        if (expandedLayout)
                        {
                            EditorGUILayout.EndHorizontal();
                        }
                        else
                        {
                            EditorGUILayout.EndVertical();
                        }
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.Space();
                    }
                }
            }

            EditorGUILayout.EndScrollView();
            if (!expandedLayout)
            {
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }
            if ((updatedContent) && (null != window))
            {
                window.Reset();
            }

            return(true);
        }
        else
        {
            return(false);
        }
    }
Example #30
0
    /****************************************************************************************************/
    private void CreateExpressionSetGUI()
    {
        EditorGUILayout.BeginVertical();
        {
            EditorGUILayout.LabelField("Step 2: Expression Set", titleStyle, GUILayout.ExpandHeight(true));

            EditorGUILayout.BeginHorizontal(exprSetBgStyle, GUILayout.Width(492));
            {
                expressionScrollPos = GUILayout.BeginScrollView(expressionScrollPos, false, true, GUILayout.Width(491), GUILayout.Height(300));
                EditorGUILayout.BeginVertical();
                GUILayoutOption buttonWidth = GUILayout.Width(95);
                foreach (KeyValuePair <string, string> kvp in charSetupData.GetExpressionNameAttrList())
                {
                    EditorGUILayout.BeginHorizontal(exprBgStyle);
                    {
                        bool hasData = charSetupData.InUse(kvp.Value);
                        GUILayout.Label(hasData ? yesIcon : noIcon, GUILayout.Width(20));
                        EditorGUILayout.LabelField(kvp.Key, GUILayout.Width(205));
                        if (GUILayout.Button(hasData ? "Update Pose" : "Save Pose", buttonWidth))
                        {
                            bool updateExpression = true;
                            if (hasData)
                            {
                                updateExpression = EditorUtility.DisplayDialog("Update Pose", "Are you sure you want to overwrite this Pose?", "Yes", "No");
                            }
                            if (updateExpression)
                            {
                                List <string> controls = charSetupData.GetControlList();
                                if (controls.Count > 0)
                                {
                                    charSetupData.SetControlValues(kvp.Value, LiveUnityInterface.GetControlValues(controls));
                                    charSetupData.SetInUse(kvp.Value, true);
                                }
                            }
                        }
                        if (GUILayout.Button("Show Saved", buttonWidth))
                        {
                            Undo.RecordObjects(sceneControlObjectList.ToArray(), ("Set '" + kvp.Key + "' Expression"));
                            LiveUnityInterface.ApplyControlValues(charSetupData.GetControlValues(kvp.Value));
                        }
                        if (GUILayout.Button(helpIcon, EditorStyles.miniButton))
                        {
                            System.Diagnostics.Process.Start("http://support.facewaretech.com/entries/37471737#" + kvp.Value);
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
            GUILayout.EndScrollView();

            CreateSpace(1);
            if (GUILayout.Button("Reset Character to 'Neutral'", GUILayout.Width(496)))
            {
                LiveUnityInterface.ApplyControlValues(charSetupData.GetControlValues("neutral"));
            }
        }
        EditorGUILayout.EndVertical();
        CreateSpace(2);
    }
		public static int Toolbar(int selected, Texture[] images, GUIStyle style, GUILayoutOption[] options){}
Example #32
0
 public static string TextArea(string value, GUILayoutOption layoutOption, string api = "")
 {
     value = EditorGUILayout.TextArea(value, EditorStyles.textArea, layoutOption);
     CreateMenu(api);
     return(value);
 }
		public static int SelectionGrid(int selected, String[] texts, int xCount, GUIStyle style, GUILayoutOption[] options){}
Example #34
0
 public static Object ObjectField <T> (Object value, bool allowSceneObjects, GUILayoutOption option1, GUILayoutOption option2, string api = "")
 {
     value = EditorGUILayout.ObjectField(value, typeof(T), allowSceneObjects, option1, option2);
     CreateMenu(api);
     return(value);
 }
		public static int SelectionGrid(int selected, GUIContent[] contents, int xCount, GUIStyle style, GUILayoutOption[] options){}
Example #36
0
 public static Vector3 Vector2Field(string label, Vector3 value, GUILayoutOption layoutOption, string api = "", string tooltip = "")
 {
     value = EditorGUILayout.Vector3Field(new GUIContent(label, tooltip), value, layoutOption);
     CreateMenu(api);
     return(value);
 }
		public static float VerticalSlider(float value, float leftValue, float rightValue, GUILayoutOption[] options){}
Example #38
0
 public static void LabelField(string label, GUILayoutOption layoutOption, string api = "")
 {
     EditorGUILayout.LabelField(label, layoutOption);
     CreateMenu(api);
 }
		public static float HorizontalScrollbar(float value, float size, float leftValue, float rightValue, GUIStyle style, GUILayoutOption[] options){}
Example #40
0
 public static float FloatField(float value, GUILayoutOption layoutOption, string api = "")
 {
     value = EditorGUILayout.FloatField(value, layoutOption);
     CreateMenu(api);
     return(value);
 }
		public static void BeginHorizontal(GUILayoutOption[] options){}
Example #42
0
 public static string TextField(string value, GUILayoutOption layoutOption, string api = "")
 {
     value = EditorGUILayout.TextField(value, layoutOption);
     CreateMenu(api);
     return(value);
 }
		public static void BeginHorizontal(Texture image, GUIStyle style, GUILayoutOption[] options){}
    /// <summary>
    /// 绘制旋转
    /// </summary>
    void DrawRotation()
    {
        GUILayout.BeginHorizontal();
        {
            bool reset = GUILayout.Button("重置", GUILayout.Width(35f));

            Vector3 visible = (serializedObject.targetObject as Transform).localEulerAngles;

            visible.x = WrapAngle(visible.x);
            visible.y = WrapAngle(visible.y);
            visible.z = WrapAngle(visible.z);

            Axes changed = CheckDifference(mRot);
            Axes altered = Axes.None;

            GUILayoutOption opt = GUILayout.MinWidth(30f);

            if (FloatField("X", ref visible.x, (changed & Axes.X) != 0, opt))
            {
                altered |= Axes.X;
            }
            if (FloatField("Y", ref visible.y, (changed & Axes.Y) != 0, opt))
            {
                altered |= Axes.Y;
            }
            if (FloatField("Z", ref visible.z, (changed & Axes.Z) != 0, opt))
            {
                altered |= Axes.Z;
            }

            if (reset)
            {
                mRot.quaternionValue = Quaternion.identity;
            }
            else if (altered != Axes.None)
            {
                RegisterUndo("Change Rotation", serializedObject.targetObjects);

                foreach (Object obj in serializedObject.targetObjects)
                {
                    Transform t = obj as Transform;
                    Vector3   v = t.localEulerAngles;

                    if ((altered & Axes.X) != 0)
                    {
                        v.x = visible.x;
                    }
                    if ((altered & Axes.Y) != 0)
                    {
                        v.y = visible.y;
                    }
                    if ((altered & Axes.Z) != 0)
                    {
                        v.z = visible.z;
                    }

                    t.localEulerAngles = v;
                }
            }
        }
        GUILayout.EndHorizontal();
    }
		public static void BeginVertical(string text, GUIStyle style, GUILayoutOption[] options){}
Example #46
0
    void OnGUI()
    {
                #if UNITY_IOS
        EditorGUILayout.BeginVertical();
        GUILayoutOption[] options = new GUILayoutOption[2] {
            GUILayout.Height(30), GUILayout.Width(100)
        };
        GUIStyle style1 = new GUIStyle();
        style1.fontSize         = 15;
        style1.fixedWidth       = 150;
        style1.normal.textColor = Color.white;

        GUIStyle style2 = new GUIStyle();
        style2.fontSize         = 16;
        style2.fixedWidth       = 150;
        style2.normal.textColor = Color.cyan;

        EditorGUILayout.BeginHorizontal();

        EditorGUILayout.LabelField("Build Type:", style1, options);
        index1 = EditorGUILayout.Popup(index1, new string[] { "Deverlop", "Distribution" }, style2, options);

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();

        EditorGUILayout.LabelField("Bundle Id:", style1, options);
        index2 = EditorGUILayout.Popup(index2, new string[] { "Magikid", "Angellecho" }, style2, options);

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();

        EditorGUILayout.LabelField("Store Type:", style1, options);
        index3 = EditorGUILayout.Popup(index3, new string[] { "APPSTORE", "SELLCHECK", "UNLOCK" }, style2, options);

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();

        EditorGUILayout.LabelField("Build Version:", style1, options);
        EditorGUILayout.LabelField(PlayerSettings.bundleVersion, style1, options);

        EditorGUILayout.EndHorizontal();

//        EditorGUILayout.BeginHorizontal ();

//        EditorGUILayout.LabelField("Build Code:", style1, options);
//        EditorGUILayout.LabelField(PlayerSettings.Android.bundleVersionCode.ToString() , style1, options);

//        EditorGUILayout.EndHorizontal();

        GUILayout.Space(20);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(60);
        if (GUILayout.Button("Build", GUILayout.Height(80), GUILayout.Width(100)))
        {
            if (EditorUtility.DisplayDialog("提示", "确定压包么?,请清空Xcode的生成APP", "Yes", "No"))
            {
                if (index1 == 0)
                {
                    EditorApplication.delayCall += VBuildDeverlop;
                }
                else
                {
                    EditorApplication.delayCall += VBulidDistribution;
                }
            }
        }

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.EndVertical();
        #endif

        /*
         #elif UNITY_ANDROID
         *      GUILayout.Space (20);
         * EditorGUILayout.BeginVertical ();
         *
         * GUILayoutOption[] options = new GUILayoutOption[2]{GUILayout.Height (30), GUILayout.Width (100)};
         * GUIStyle style1 = new GUIStyle ();
         * style1.fontSize = 15;
         * style1.fixedWidth = 150;
         * style1.normal.textColor = Color.white;
         *
         * GUIStyle style2 = new GUIStyle ();
         * style2.fontSize = 16;
         * style2.fixedWidth = 150;
         * style2.normal.textColor = Color.cyan;
         *
         *
         * EditorGUILayout.LabelField("Android Channel:", style1, options);
         *
         * EditorGUILayout.BeginHorizontal ();
         * GUILayout.Space (60);
         * index1 = EditorGUILayout.Popup (index1, androidChannels , style2, options);
         * EditorGUILayout.EndHorizontal();
         *
         *      GUILayout.Space (30);
         * EditorGUILayout.BeginHorizontal ();
         * GUILayout.Space (60);
         *      if (GUILayout.Button("Build",GUILayout.Height(80),GUILayout.Width(100)))
         *      {
         *              EditorApplication.delayCall += VBulidAndroid;
         *      }
         * EditorGUILayout.EndHorizontal();
         *
         *      EditorGUILayout.BeginHorizontal ();
         * GUILayout.Space (60);
         *      if (GUILayout.Button("BuildRun",GUILayout.Height(80),GUILayout.Width(100)))
         *      {
         *              EditorApplication.delayCall += VBulidAndRunAndroid;
         *      }
         * EditorGUILayout.EndHorizontal();
         * EditorGUILayout.EndVertical();
         #endif
         */
    }
		public static void BeginVertical(GUIContent content, GUIStyle style, GUILayoutOption[] options){}
Example #48
0
        protected override void GetGui()
        {
            GUILayout.BeginVertical(Array.Empty <GUILayoutOption>());
            bool flag = GUI.get_enabled();

            if (base.Button("FB.Init"))
            {
                FB.Init(new InitDelegate(this.OnInitComplete), new HideUnityDelegate(this.OnHideUnity), null);
                base.Status = "FB.Init() called with " + FB.AppId;
            }
            GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>());
            GUI.set_enabled(flag && FB.IsInitialized);
            if (base.Button("Login"))
            {
                this.CallFBLogin();
                base.Status = "Login called";
            }
            GUI.set_enabled(FB.IsLoggedIn);
            if (base.Button("Get publish_actions"))
            {
                this.CallFBLoginForPublish();
                base.Status = "Login (for publish_actions) called";
            }
            GUILayoutOption[] optionArray1 = new GUILayoutOption[] { GUILayout.MinWidth((float)ConsoleBase.MarginFix) };
            GUILayout.Label(GUIContent.none, optionArray1);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>());
            GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.MinWidth((float)ConsoleBase.MarginFix) };
            GUILayout.Label(GUIContent.none, optionArray2);
            GUILayout.EndHorizontal();
            if (base.Button("Logout"))
            {
                this.CallFBLogout();
                base.Status = "Logout called";
            }
            GUI.set_enabled(flag && FB.IsInitialized);
            if (base.Button("Share Dialog"))
            {
                base.SwitchMenu(typeof(DialogShare));
            }
            if (base.Button("App Requests"))
            {
                base.SwitchMenu(typeof(AppRequests));
            }
            if (base.Button("Graph Request"))
            {
                base.SwitchMenu(typeof(GraphRequest));
            }
            if (Constants.IsWeb && base.Button("Pay"))
            {
                base.SwitchMenu(typeof(Pay));
            }
            if (base.Button("App Events"))
            {
                base.SwitchMenu(typeof(AppEvents));
            }
            if (base.Button("App Links"))
            {
                base.SwitchMenu(typeof(AppLinks));
            }
            if (Constants.IsMobile && base.Button("App Invites"))
            {
                base.SwitchMenu(typeof(AppInvites));
            }
            if (Constants.IsMobile && base.Button("Access Token"))
            {
                base.SwitchMenu(typeof(AccessTokenMenu));
            }
            GUILayout.EndVertical();
            GUI.set_enabled(flag);
        }
		internal static GUILayoutGroup BeginLayoutGroup(GUIStyle style, GUILayoutOption[] options, Type LayoutType){}
        void OnGUI()
        {
            if (!ShowLog)
            {
                return;
            }
            if (!ShowInEditor && Application.isEditor)
            {
                return;
            }

            if (AdvancedButtons && (buttonWidth == null || buttonHeight == null))
            {
                buttonWidth  = GUILayout.Width(25f);
                buttonHeight = GUILayout.Height(25f);
            }

            float w = (Screen.width - 2 * Margin) * Width;
            float h = (Screen.height - 2 * Margin) * Height;
            float x = 1, y = 1;

            switch (AnchorPosition)
            {
            case LogAnchor.BottomLeft:
                x = Margin;
                y = Margin + (Screen.height - 2 * Margin) * (1 - Height);
                break;

            case LogAnchor.BottomRight:
                x = Margin + (Screen.width - 2 * Margin) * (1 - Width);
                y = Margin + (Screen.height - 2 * Margin) * (1 - Height);
                break;

            case LogAnchor.TopLeft:
                x = Margin;
                y = Margin;
                break;

            case LogAnchor.TopRight:
                x = Margin + (Screen.width - 2 * Margin) * (1 - Width);
                y = Margin;
                break;
            }

            GUILayout.BeginArea(new Rect((int)x, (int)y, w, h), styleContainer);

            if (AdvancedButtons)
            {
                GUILayout.BeginHorizontal();
                GUILayout.BeginVertical(buttonWidth);

                if (GUILayout.Button(ScrollToTop, buttonHeight))
                {
                    manuallyScroll   = true;
                    scrollPosition.y = 0;
                }

                GUILayout.Space(10f);

                if (GUILayout.RepeatButton(ScrollUp, buttonHeight))
                {
                    manuallyScroll    = true;
                    scrollPosition.y -= ScrollSpeed;
                }

                GUILayout.FlexibleSpace();

                if (GUILayout.RepeatButton(ScrollDown, buttonHeight))
                {
                    manuallyScroll    = true;
                    scrollPosition.y += ScrollSpeed;
                }

                GUILayout.Space(10f);

                if (GUILayout.Button(ScrollToBottom, buttonHeight))
                {
                    manuallyScroll = false;
                }

                if (!manuallyScroll)
                {
                    scrollPosition.y = int.MaxValue;
                }

                GUILayout.EndVertical();
                GUILayout.BeginVertical();
            }

            scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false);

            var started = false;

            foreach (LogMessage m in queue)
            {
                switch (m.Type)
                {
                case LogType.Warning:
                    styleText.normal.textColor = WarningColor;
                    break;

                case LogType.Log:
                    styleText.normal.textColor = MessageColor;
                    break;

                case LogType.Assert:
                case LogType.Exception:
                case LogType.Error:
                    styleText.normal.textColor = ErrorColor;
                    break;

                default:
                    styleText.normal.textColor = MessageColor;
                    break;
                }

                if (!m.Message.StartsWith(Space) && started)
                {
                    GUILayout.Space(FontSize);
                }

                GUILayout.Label(m.Message, styleText);
                started = true;
            }

            GUILayout.EndScrollView();

            if (AdvancedButtons)
            {
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();

                if (GUILayout.Button(ClearView, buttonHeight))
                {
                    queue.Clear();
                }
            }

            GUILayout.EndArea();
        }
		private static Rect DoGetRect(GUIContent content, GUIStyle style, GUILayoutOption[] options){}
Example #52
0
 public override void OnPreviewSettings()
 {
     if (this.IsCubemap())
     {
         this.m_CubemapPreview.OnPreviewSettings(base.targets);
     }
     else
     {
         if (s_Styles == null)
         {
             s_Styles = new Styles();
         }
         Texture target = this.target as Texture;
         bool    flag   = true;
         bool    flag2  = false;
         bool    flag3  = true;
         int     a      = 1;
         if ((this.target is Texture2D) || (this.target is ProceduralTexture))
         {
             flag2 = true;
             flag3 = false;
         }
         foreach (Texture texture2 in base.targets)
         {
             TextureFormat format = (TextureFormat)0;
             bool          flag4  = false;
             if (texture2 is Texture2D)
             {
                 format = (texture2 as Texture2D).format;
                 flag4  = true;
             }
             else if (texture2 is ProceduralTexture)
             {
                 format = (texture2 as ProceduralTexture).format;
                 flag4  = true;
             }
             if (flag4)
             {
                 a = Mathf.Max(a, TextureUtil.CountMipmaps(texture2));
                 if (!TextureUtil.IsAlphaOnlyTextureFormat(format))
                 {
                     flag2 = false;
                 }
                 if (TextureUtil.HasAlphaTextureFormat(format) && (TextureUtil.GetUsageMode(texture2) == TextureUsageMode.Default))
                 {
                     flag3 = true;
                 }
             }
         }
         if (flag2)
         {
             this.m_ShowAlpha = true;
             flag             = false;
         }
         else if (!flag3)
         {
             this.m_ShowAlpha = false;
             flag             = false;
         }
         if (flag && !IsNormalMap(target))
         {
             this.m_ShowAlpha = GUILayout.Toggle(this.m_ShowAlpha, !this.m_ShowAlpha ? s_Styles.RGBIcon : s_Styles.alphaIcon, s_Styles.previewButton, new GUILayoutOption[0]);
         }
         GUI.enabled = a != 1;
         GUILayout.Box(s_Styles.smallZoom, s_Styles.previewLabel, new GUILayoutOption[0]);
         GUI.changed = false;
         GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MaxWidth(64f) };
         this.m_MipLevel = Mathf.Round(GUILayout.HorizontalSlider(this.m_MipLevel, (float)(a - 1), 0f, s_Styles.previewSlider, s_Styles.previewSliderThumb, options));
         GUILayout.Box(s_Styles.largeZoom, s_Styles.previewLabel, new GUILayoutOption[0]);
         GUI.enabled = true;
     }
 }
		public static Rect GetRect(float minWidth, float maxWidth, float minHeight, float maxHeight, GUILayoutOption[] options){}
    /****************************************************************************************************/
    private void CreateFileGUI()
    {
        EditorGUILayout.BeginVertical("Box");         //Root layout group
        {
            EditorGUILayout.LabelField("Faceware Live Client for Unity - Character Setup", titleStyle);

            EditorGUI.BeginChangeCheck();
            currentCharSetupFile = (LiveCharacterSetupFile)EditorGUILayout.ObjectField("Character Setup File: ", currentCharSetupFile, typeof(LiveCharacterSetupFile), false);
            if (EditorGUI.EndChangeCheck())
            {
                if (currentCharSetupFile == null)
                {
                    charSetupData.Init(new List <Expression>(), new List <string>());
                }
                else
                {
                    charSetupData.Init(currentCharSetupFile.Expressions, currentCharSetupFile.Controls);

                    //Check for root object
                    if (currentCharSetupFile.rootObjectName != null)
                    {
                        GameObject rootObject = GameObject.Find(currentCharSetupFile.rootObjectName);
                        if (rootObject != null)
                        {
                            //We have it
                            currentCharSetupFile.rootObject = rootObject;
                            ValidateControls();
                        }
                        else
                        {
                            //Don't have it in scene, prompt user
                            EditorUtility.DisplayDialog("Unable to find character!", "The character " + currentCharSetupFile.rootObjectName + " could not be found in the scene!", "Ok");
                        }
                    }
                }

                controlSelection.Clear();
                addedControls.Clear();
                sceneControlObjectList.Clear();
                InitAddedControls();
            }

            EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); //Buttons' control group
            {
                GUILayoutOption buttonWidth = GUILayout.Width(162);
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("New", buttonWidth))
                {
                    bool success = CreateNewCharacterSetupFile();
                    if (success)
                    {
                        charSetupData.Init(currentCharSetupFile.Expressions, currentCharSetupFile.Controls);
                        controlSelection.Clear();
                        addedControls.Clear();
                        sceneControlObjectList.Clear();
                    }
                }
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Save", buttonWidth))
                {
                    EditorUtility.SetDirty(currentCharSetupFile);
                    AssetDatabase.SaveAssets();
                }
                GUILayout.FlexibleSpace();
            }
            EditorGUILayout.EndHorizontal(); //End buttons' control group
            CreateSpace(1);
        }
        EditorGUILayout.EndVertical();
        CreateSpace(1);
    }
		public static Rect GetAspectRect(float aspect, GUIStyle style, GUILayoutOption[] options){}
    /****************************************************************************************************/
    private void CreateExpressionSetGUI()
    {
        EditorGUILayout.BeginVertical("Box");         //Root layout group
        {
            EditorGUILayout.LabelField("Step 2: Expression Set", titleStyle);
            EditorGUILayout.BeginHorizontal("Box");                                                                       //Scroll view container region
            {
                expressionScrollPos = GUILayout.BeginScrollView(expressionScrollPos, false, true, GUILayout.Height(300)); //Scroll view region
                EditorGUILayout.BeginVertical();
                GUILayoutOption buttonWidth = GUILayout.Width(95);
                foreach (KeyValuePair <string, string> kvp in charSetupData.GetExpressionNameAttrList()) //Create controls within scroll view
                {
                    EditorGUILayout.BeginHorizontal();                                                   //Individual control region
                    {
                        bool hasData = charSetupData.InUse(kvp.Value);
                        GUILayout.Label(hasData ? yesIcon : noIcon, GUILayout.Width(20));
                        EditorGUILayout.LabelField(kvp.Key, GUILayout.Width(205));
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button(hasData ? "Update Pose" : "Save Pose", buttonWidth))
                        {
                            bool updateExpression = true;
                            if (hasData)
                            {
                                updateExpression = EditorUtility.DisplayDialog("Update Pose", "Are you sure you want to overwrite this Pose?", "Yes", "No");
                            }
                            if (updateExpression)
                            {
                                List <string> controls = charSetupData.GetControlList();
                                if (controls.Count > 0)
                                {
                                    charSetupData.SetControlValues(kvp.Value, LiveUnityInterface.GetControlValues(currentCharSetupFile.rootObject, controls));
                                    charSetupData.SetInUse(kvp.Value, true);
                                    currentCharSetupFile.Expressions = charSetupData.data.Expressions;
                                    EditorUtility.SetDirty(currentCharSetupFile);
                                    AssetDatabase.SaveAssets();
                                }
                            }
                        }
                        if (GUILayout.Button("Show Saved", buttonWidth))
                        {
                            Undo.RecordObjects(sceneControlObjectList.ToArray(), ("Set '" + kvp.Key + "' Expression"));
                            LiveUnityInterface.ApplyControlValues(currentCharSetupFile.rootObject, charSetupData.GetControlValues(kvp.Value));
                        }
                    }
                    EditorGUILayout.EndHorizontal(); //End of individual control region
                }
                GUILayout.EndScrollView();           //End scroll view region
                GUILayout.FlexibleSpace();
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();

            CreateSpace(1);
            EditorGUILayout.BeginHorizontal(); //Reset to neutral button region
            {
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Reset Character to 'Neutral'", GUILayout.Width(496)))
                {
                    if (currentCharSetupFile != null)
                    {
                        LiveUnityInterface.ApplyControlValues(currentCharSetupFile.rootObject, charSetupData.GetControlValues("neutral"));
                    }
                    else
                    {
                        ShowNoSetupFileMsg();
                    }
                }
                GUILayout.FlexibleSpace();
            }
            EditorGUILayout.EndHorizontal(); //End neutral button region
        }
        CreateSpace(1);
        EditorGUILayout.EndVertical();
        CreateSpace(1);
    }
Example #57
0
 // TODO:
 //public static bool Toggle(bool value, GUIContent content, GUIStyle style, GUILayoutOption[] options)
 //public static bool Toggle(bool value, Texture image, GUIStyle style, GUILayoutOption[] options)
 //public static bool Toggle(bool value, Texture image, GUILayoutOption[] options)
 //public static bool Toggle(bool value, string text, GUIStyle style, GUILayoutOption[] options)
 //public static bool Toggle(bool value, GUIContent content, GUILayoutOption[] options)
 private static bool DoToggle(bool value, GUIContent content, GUIStyle style, GUILayoutOption[] options)
 {
     // TODO: Implement this
     return false;
 }
Example #58
0
        private void OnGUI()
        {
            ConsoleWindow.LoadIcons();
            if (background == null)
            {
                background = "AppToolbar";
            }
            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                GUI.color = (Color)HostView.kPlayModeDarken;
            }
            if (Event.current.type == EventType.Repaint)
            {
                background.Draw(new Rect(0f, 0f, base.position.width, base.position.height), false, false, false, false);
            }
            bool isCompiling = EditorApplication.isCompiling;

            GUILayout.Space(2f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(2f);
            string statusText = LogEntries.GetStatusText();

            if (statusText != null)
            {
                int      statusMask = LogEntries.GetStatusMask();
                GUIStyle statusStyleForErrorMode = ConsoleWindow.GetStatusStyleForErrorMode(statusMask);
                GUILayout.Label(ConsoleWindow.GetIconForErrorMode(statusMask, false), statusStyleForErrorMode, new GUILayoutOption[0]);
                GUILayout.Space(2f);
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.Space(2f);
                if (isCompiling)
                {
                    GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MaxWidth(GUIView.current.position.width - 52f) };
                    GUILayout.Label(statusText, statusStyleForErrorMode, options);
                }
                else
                {
                    GUILayout.Label(statusText, statusStyleForErrorMode, new GUILayoutOption[0]);
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndVertical();
                if (Event.current.type == EventType.MouseDown)
                {
                    Event.current.Use();
                    LogEntries.ClickStatusBar(Event.current.clickCount);
                    GUIUtility.ExitGUI();
                }
            }
            GUILayout.EndHorizontal();
            if (Event.current.type == EventType.Repaint)
            {
                float x = base.position.width - 24f;
                if (AsyncProgressBar.isShowing)
                {
                    x -= 188f;
                    EditorGUI.ProgressBar(new Rect(x, 0f, 185f, 19f), AsyncProgressBar.progress, AsyncProgressBar.progressInfo);
                }
                if (isCompiling)
                {
                    int index = (int)Mathf.Repeat(Time.realtimeSinceStartup * 10f, 11.99f);
                    GUI.Label(new Rect(base.position.width - 24f, 0f, (float)s_StatusWheel[index].image.width, (float)s_StatusWheel[index].image.height), s_StatusWheel[index], GUIStyle.none);
                }
                if (Unsupported.IsBleedingEdgeBuild())
                {
                    Color color = GUI.color;
                    GUI.color = Color.yellow;
                    GUI.Label(new Rect(x - 310f, 0f, 310f, 19f), "THIS IS AN UNTESTED BLEEDINGEDGE UNITY BUILD");
                    GUI.color = color;
                }
                else if (Unsupported.IsDeveloperBuild())
                {
                    GUI.Label(new Rect(x - 200f, 0f, 200f, 19f), this.m_LastMiniMemoryOverview, EditorStyles.progressBarText);
                    EditorGUIUtility.CleanCache(this.m_LastMiniMemoryOverview);
                }
            }
            base.DoWindowDecorationEnd();
            EditorGUI.ShowRepaints();
        }
 public static Rect GetRect(GUIContent[] contents, int xCount, GUIStyle style, GUILayoutOption[] options)
 {
   Rect rect = new Rect(0.0f, 0.0f, 0.0f, 0.0f);
   switch (Event.current.type)
   {
     case EventType.Layout:
       GUILayoutUtility.current.topLevel.Add((GUILayoutEntry) new GUIGridSizer(contents, xCount, style, options));
       break;
     case EventType.Used:
       return GUILayoutEntry.kDummyRect;
     default:
       rect = GUILayoutUtility.current.topLevel.GetNext().rect;
       break;
   }
   return rect;
 }
Example #60
0
        public void OnGUI()
        {
            Event current = Event.current;
            bool  flag    = false;
            bool  flag2   = false;

            if (current.type == EventType.KeyDown)
            {
                flag  = current.keyCode == KeyCode.Escape;
                flag2 = (current.keyCode == KeyCode.Return) || (current.keyCode == KeyCode.KeypadEnter);
            }
            using (HorizontalLayout.DoLayout())
            {
                GUILayout.Space(10f);
                using (VerticalLayout.DoLayout())
                {
                    GUILayout.FlexibleSpace();
                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayoutOption[] options = new GUILayoutOption[] { kLabelWidth };
                        GUILayout.Label(EditorGUIUtility.TextContent("Password|Certificate password."), options);
                        GUI.SetNextControlName("password");
                        this.password = GUILayout.PasswordField(this.password, '●', new GUILayoutOption[0]);
                    }
                    GUILayout.Space(10f);
                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayout.Label(this.message, this.messageStyle, new GUILayoutOption[0]);
                        GUILayout.FlexibleSpace();
                        GUILayoutOption[] optionArray2 = new GUILayoutOption[] { kButtonWidth };
                        if (GUILayout.Button(EditorGUIUtility.TextContent("Ok"), optionArray2) || flag2)
                        {
                            this.message = GUIContent.none;
                            try
                            {
                                if (PlayerSettings.WSA.SetCertificate(this.path, this.password))
                                {
                                    flag = true;
                                }
                                else
                                {
                                    this.message = EditorGUIUtility.TextContent("Invalid password.");
                                }
                            }
                            catch (UnityException exception)
                            {
                                Debug.LogError(exception.Message);
                            }
                        }
                    }
                    GUILayout.FlexibleSpace();
                }
                GUILayout.Space(10f);
            }
            if (flag)
            {
                base.Close();
            }
            else if (this.focus != null)
            {
                EditorGUI.FocusTextInControl(this.focus);
                this.focus = null;
            }
        }