Set() public method

public Set ( GameViewSize other ) : void
other GameViewSize
return void
コード例 #1
0
        public void Replace(int index, object obj)
        {
            GameViewSize gameViewSize = GameViewSizesMenuItemProvider.CastToGameViewSize(obj);

            if (gameViewSize == null)
            {
                return;
            }
            if (index < this.m_GameViewSizeGroup.GetBuiltinCount())
            {
                Debug.LogError("Only custom game view sizes can be changed");
                return;
            }
            GameViewSize gameViewSize2 = this.m_GameViewSizeGroup.GetGameViewSize(index);

            if (gameViewSize2 != null)
            {
                gameViewSize2.Set(gameViewSize);
                ScriptableSingleton <GameViewSizes> .instance.SaveToHDD();
            }
        }
コード例 #2
0
        public void Replace(int index, object obj)
        {
            GameViewSize other = CastToGameViewSize(obj);

            if (other != null)
            {
                if (index < this.m_GameViewSizeGroup.GetBuiltinCount())
                {
                    Debug.LogError("Only custom game view sizes can be changed");
                }
                else
                {
                    GameViewSize gameViewSize = this.m_GameViewSizeGroup.GetGameViewSize(index);
                    if (gameViewSize != null)
                    {
                        gameViewSize.Set(other);
                        ScriptableSingleton <GameViewSizes> .instance.SaveToHDD();
                    }
                }
            }
        }
コード例 #3
0
        public void Replace(int index, object obj)
        {
            GameViewSize newResolution = CastToGameViewSize(obj);

            if (newResolution == null)
            {
                return;
            }

            if (index < m_GameViewSizeGroup.GetBuiltinCount())
            {
                Debug.LogError("Only custom game view sizes can be changed");
                return;
            }

            GameViewSize gameViewSize = m_GameViewSizeGroup.GetGameViewSize(index);

            if (gameViewSize != null)
            {
                gameViewSize.Set(newResolution);
                GameViewSizes.instance.SaveToHDD();
            }
        }
コード例 #4
0
        public override void OnGUI(Rect rect)
        {
            if (GameViewSizesMenuModifyItemUI.s_Styles == null)
            {
                GameViewSizesMenuModifyItemUI.s_Styles = new GameViewSizesMenuModifyItemUI.Styles();
            }
            GameViewSize gameViewSize = this.m_Object as GameViewSize;

            if (gameViewSize == null)
            {
                Debug.LogError("Invalid object");
            }
            else
            {
                if (this.m_GameViewSize == null)
                {
                    this.m_GameViewSize = new GameViewSize(gameViewSize);
                }
                bool flag = this.m_GameViewSize.width > 0 && this.m_GameViewSize.height > 0;
                GUILayout.Space(3f);
                GUILayout.Label((this.m_MenuType != FlexibleMenuModifyItemUI.MenuType.Add) ? GameViewSizesMenuModifyItemUI.s_Styles.headerEdit : GameViewSizesMenuModifyItemUI.s_Styles.headerAdd, EditorStyles.boldLabel, new GUILayoutOption[0]);
                Rect rect2 = GUILayoutUtility.GetRect(1f, 1f);
                FlexibleMenu.DrawRect(rect2, (!EditorGUIUtility.isProSkin) ? new Color(0.6f, 0.6f, 0.6f, 1.333f) : new Color(0.32f, 0.32f, 0.32f, 1.333f));
                GUILayout.Space(4f);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Label(GameViewSizesMenuModifyItemUI.s_Styles.optionalText, new GUILayoutOption[]
                {
                    GUILayout.Width(90f)
                });
                GUILayout.Space(10f);
                this.m_GameViewSize.baseText = EditorGUILayout.TextField(this.m_GameViewSize.baseText, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Label(GameViewSizesMenuModifyItemUI.s_Styles.typeName, new GUILayoutOption[]
                {
                    GUILayout.Width(90f)
                });
                GUILayout.Space(10f);
                this.m_GameViewSize.sizeType = (GameViewSizeType)EditorGUILayout.Popup((int)this.m_GameViewSize.sizeType, GameViewSizesMenuModifyItemUI.s_Styles.typeNames, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Label(GameViewSizesMenuModifyItemUI.s_Styles.widthHeightText, new GUILayoutOption[]
                {
                    GUILayout.Width(90f)
                });
                GUILayout.Space(10f);
                this.m_GameViewSize.width = EditorGUILayout.IntField(this.m_GameViewSize.width, new GUILayoutOption[0]);
                GUILayout.Space(5f);
                this.m_GameViewSize.height = EditorGUILayout.IntField(this.m_GameViewSize.height, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                GUILayout.Space(10f);
                float num       = 10f;
                float cropWidth = rect.width - 2f * num;
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Space(num);
                GUILayout.FlexibleSpace();
                string text = this.m_GameViewSize.displayText;
                using (new EditorGUI.DisabledScope(string.IsNullOrEmpty(text)))
                {
                    if (string.IsNullOrEmpty(text))
                    {
                        text = "Result";
                    }
                    else
                    {
                        text = this.GetCroppedText(text, cropWidth, EditorStyles.label);
                    }
                    GUILayout.Label(GUIContent.Temp(text), EditorStyles.label, new GUILayoutOption[0]);
                }
                GUILayout.FlexibleSpace();
                GUILayout.Space(num);
                GUILayout.EndHorizontal();
                GUILayout.Space(5f);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Space(10f);
                if (GUILayout.Button(GameViewSizesMenuModifyItemUI.s_Styles.cancel, new GUILayoutOption[0]))
                {
                    base.editorWindow.Close();
                }
                using (new EditorGUI.DisabledScope(!flag))
                {
                    if (GUILayout.Button(GameViewSizesMenuModifyItemUI.s_Styles.ok, new GUILayoutOption[0]))
                    {
                        gameViewSize.Set(this.m_GameViewSize);
                        base.Accepted();
                        base.editorWindow.Close();
                    }
                }
                GUILayout.Space(10f);
                GUILayout.EndHorizontal();
            }
        }
コード例 #5
0
        public override void OnGUI(Rect rect)
        {
            if (GameViewSizesMenuModifyItemUI.s_Styles == null)
            {
                GameViewSizesMenuModifyItemUI.s_Styles = new GameViewSizesMenuModifyItemUI.Styles();
            }
            GameViewSize other = this.m_Object as GameViewSize;

            if (other == null)
            {
                Debug.LogError((object)"Invalid object");
            }
            else
            {
                if (this.m_GameViewSize == null)
                {
                    this.m_GameViewSize = new GameViewSize(other);
                }
                bool flag = this.m_GameViewSize.width > 0 && this.m_GameViewSize.height > 0;
                GUILayout.Space(3f);
                GUILayout.Label(this.m_MenuType != FlexibleMenuModifyItemUI.MenuType.Add ? GameViewSizesMenuModifyItemUI.s_Styles.headerEdit : GameViewSizesMenuModifyItemUI.s_Styles.headerAdd, EditorStyles.boldLabel, new GUILayoutOption[0]);
                FlexibleMenu.DrawRect(GUILayoutUtility.GetRect(1f, 1f), !EditorGUIUtility.isProSkin ? new Color(0.6f, 0.6f, 0.6f, 1.333f) : new Color(0.32f, 0.32f, 0.32f, 1.333f));
                GUILayout.Space(4f);
                GUILayout.BeginHorizontal();
                GUILayout.Label(GameViewSizesMenuModifyItemUI.s_Styles.optionalText, new GUILayoutOption[1]
                {
                    GUILayout.Width(90f)
                });
                GUILayout.Space(10f);
                this.m_GameViewSize.baseText = EditorGUILayout.TextField(this.m_GameViewSize.baseText);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                GUILayout.Label(GameViewSizesMenuModifyItemUI.s_Styles.typeName, new GUILayoutOption[1]
                {
                    GUILayout.Width(90f)
                });
                GUILayout.Space(10f);
                this.m_GameViewSize.sizeType = (GameViewSizeType)EditorGUILayout.Popup((int)this.m_GameViewSize.sizeType, GameViewSizesMenuModifyItemUI.s_Styles.typeNames);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                GUILayout.Label(GameViewSizesMenuModifyItemUI.s_Styles.widthHeightText, new GUILayoutOption[1]
                {
                    GUILayout.Width(90f)
                });
                GUILayout.Space(10f);
                this.m_GameViewSize.width = EditorGUILayout.IntField(this.m_GameViewSize.width);
                GUILayout.Space(5f);
                this.m_GameViewSize.height = EditorGUILayout.IntField(this.m_GameViewSize.height);
                GUILayout.EndHorizontal();
                GUILayout.Space(10f);
                float pixels    = 10f;
                float cropWidth = rect.width - 2f * pixels;
                GUILayout.BeginHorizontal();
                GUILayout.Space(pixels);
                GUILayout.FlexibleSpace();
                string displayText = this.m_GameViewSize.displayText;
                EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(displayText));
                GUILayout.Label(GUIContent.Temp(!string.IsNullOrEmpty(displayText) ? this.GetCroppedText(displayText, cropWidth, EditorStyles.label) : "Result"), EditorStyles.label, new GUILayoutOption[0]);
                EditorGUI.EndDisabledGroup();
                GUILayout.FlexibleSpace();
                GUILayout.Space(pixels);
                GUILayout.EndHorizontal();
                GUILayout.Space(5f);
                GUILayout.BeginHorizontal();
                GUILayout.Space(10f);
                if (GUILayout.Button(GameViewSizesMenuModifyItemUI.s_Styles.cancel))
                {
                    this.editorWindow.Close();
                }
                EditorGUI.BeginDisabledGroup(!flag);
                if (GUILayout.Button(GameViewSizesMenuModifyItemUI.s_Styles.ok))
                {
                    other.Set(this.m_GameViewSize);
                    this.Accepted();
                    this.editorWindow.Close();
                }
                EditorGUI.EndDisabledGroup();
                GUILayout.Space(10f);
                GUILayout.EndHorizontal();
            }
        }
コード例 #6
0
        override public void OnGUI(Rect rect)
        {
            if (s_Styles == null)
            {
                s_Styles = new Styles();
            }

            GameViewSize gameViewSizeState = m_Object as GameViewSize;

            if (gameViewSizeState == null)
            {
                Debug.LogError("Invalid object");
                return;
            }

            // We use a local gameviewsize to ensure we do not edit the original state (if user presses cancel state is not changed)
            if (m_GameViewSize == null)
            {
                m_GameViewSize = new GameViewSize(gameViewSizeState);
            }

            bool        validSettings = m_GameViewSize.width > 0 && m_GameViewSize.height > 0;
            const float kColumnWidth  = 90f;
            const float kSpacing      = 10f;

            GUILayout.Space(3);
            GUILayout.Label(m_MenuType == MenuType.Add ? s_Styles.headerAdd : s_Styles.headerEdit,
                            EditorStyles.boldLabel);

            Rect seperatorRect = GUILayoutUtility.GetRect(1, 1);

            FlexibleMenu.DrawRect(seperatorRect,
                                  (EditorGUIUtility.isProSkin)
                ? new Color(0.32f, 0.32f, 0.32f, 1.333f)
                : new Color(0.6f, 0.6f, 0.6f, 1.333f));                      // dark : light
            GUILayout.Space(4);

            // Optional text
            GUILayout.BeginHorizontal();
            GUILayout.Label(s_Styles.optionalText, GUILayout.Width(kColumnWidth));
            GUILayout.Space(kSpacing);
            m_GameViewSize.baseText = EditorGUILayout.TextField(m_GameViewSize.baseText);
            GUILayout.EndHorizontal();

            // Drop list (aspect / fixed res)
            GUILayout.BeginHorizontal();
            GUILayout.Label(s_Styles.typeName, GUILayout.Width(kColumnWidth));
            GUILayout.Space(kSpacing);
            m_GameViewSize.sizeType = (GameViewSizeType)EditorGUILayout.Popup((int)m_GameViewSize.sizeType, s_Styles.typeNames);
            GUILayout.EndHorizontal();

            // Width Height
            GUILayout.BeginHorizontal();
            GUILayout.Label(s_Styles.widthHeightText, GUILayout.Width(kColumnWidth));
            GUILayout.Space(kSpacing);
            m_GameViewSize.width = EditorGUILayout.IntField(m_GameViewSize.width);
            GUILayout.Space(5);
            m_GameViewSize.height = EditorGUILayout.IntField(m_GameViewSize.height);
            GUILayout.EndHorizontal();

            GUILayout.Space(10f);

            // Displayed text
            float margin    = 10f;
            float cropWidth = rect.width - 2 * margin;

            GUILayout.BeginHorizontal();
            GUILayout.Space(margin);
            GUILayout.FlexibleSpace();
            string displayText = m_GameViewSize.displayText;

            using (new EditorGUI.DisabledScope(string.IsNullOrEmpty(displayText)))
            {
                if (string.IsNullOrEmpty(displayText))
                {
                    displayText = "Result";
                }
                else
                {
                    displayText = GetCroppedText(displayText, cropWidth, EditorStyles.label);
                }
                GUILayout.Label(GUIContent.Temp(displayText), EditorStyles.label);
            }
            GUILayout.FlexibleSpace();
            GUILayout.Space(margin);
            GUILayout.EndHorizontal();

            GUILayout.Space(5f);

            // Cancel, Ok
            GUILayout.BeginHorizontal();
            GUILayout.Space(10);
            if (GUILayout.Button(s_Styles.cancel))
            {
                editorWindow.Close();
            }

            using (new EditorGUI.DisabledScope(!validSettings))
            {
                if (GUILayout.Button(s_Styles.ok))
                {
                    gameViewSizeState.Set(m_GameViewSize);
                    Accepted();
                    editorWindow.Close();
                }
            }
            GUILayout.Space(10);
            GUILayout.EndHorizontal();
        }
コード例 #7
0
        public override void OnGUI(Rect rect)
        {
            if (s_Styles == null)
            {
                s_Styles = new Styles();
            }
            GameViewSize other = base.m_Object as GameViewSize;

            if (other == null)
            {
                Debug.LogError("Invalid object");
            }
            else
            {
                if (this.m_GameViewSize == null)
                {
                    this.m_GameViewSize = new GameViewSize(other);
                }
                bool flag = (this.m_GameViewSize.width > 0) && (this.m_GameViewSize.height > 0);
                GUILayout.Space(3f);
                GUILayout.Label((base.m_MenuType != FlexibleMenuModifyItemUI.MenuType.Add) ? s_Styles.headerEdit : s_Styles.headerAdd, EditorStyles.boldLabel, new GUILayoutOption[0]);
                FlexibleMenu.DrawRect(GUILayoutUtility.GetRect((float)1f, (float)1f), !EditorGUIUtility.isProSkin ? new Color(0.6f, 0.6f, 0.6f, 1.333f) : new Color(0.32f, 0.32f, 0.32f, 1.333f));
                GUILayout.Space(4f);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(90f) };
                GUILayout.Label(s_Styles.optionalText, options);
                GUILayout.Space(10f);
                this.m_GameViewSize.baseText = EditorGUILayout.TextField(this.m_GameViewSize.baseText, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(90f) };
                GUILayout.Label(s_Styles.typeName, optionArray2);
                GUILayout.Space(10f);
                this.m_GameViewSize.sizeType = (GameViewSizeType)EditorGUILayout.Popup((int)this.m_GameViewSize.sizeType, s_Styles.typeNames, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Width(90f) };
                GUILayout.Label(s_Styles.widthHeightText, optionArray3);
                GUILayout.Space(10f);
                this.m_GameViewSize.width = EditorGUILayout.IntField(this.m_GameViewSize.width, new GUILayoutOption[0]);
                GUILayout.Space(5f);
                this.m_GameViewSize.height = EditorGUILayout.IntField(this.m_GameViewSize.height, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                GUILayout.Space(10f);
                float pixels    = 10f;
                float cropWidth = rect.width - (2f * pixels);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Space(pixels);
                GUILayout.FlexibleSpace();
                string displayText = this.m_GameViewSize.displayText;
                using (new EditorGUI.DisabledScope(string.IsNullOrEmpty(displayText)))
                {
                    if (string.IsNullOrEmpty(displayText))
                    {
                        displayText = "Result";
                    }
                    else
                    {
                        displayText = this.GetCroppedText(displayText, cropWidth, EditorStyles.label);
                    }
                    GUILayout.Label(GUIContent.Temp(displayText), EditorStyles.label, new GUILayoutOption[0]);
                }
                GUILayout.FlexibleSpace();
                GUILayout.Space(pixels);
                GUILayout.EndHorizontal();
                GUILayout.Space(5f);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Space(10f);
                if (GUILayout.Button(s_Styles.cancel, new GUILayoutOption[0]))
                {
                    base.editorWindow.Close();
                }
                using (new EditorGUI.DisabledScope(!flag))
                {
                    if (GUILayout.Button(s_Styles.ok, new GUILayoutOption[0]))
                    {
                        other.Set(this.m_GameViewSize);
                        base.Accepted();
                        base.editorWindow.Close();
                    }
                }
                GUILayout.Space(10f);
                GUILayout.EndHorizontal();
            }
        }