Beispiel #1
0
        protected override void OnInspectorGUI(List <Texture> found)
        {
            Vector2 MAX_SIZE = new Vector2(256, 256);
            Texture remove   = null;

            foreach (Object o in found)
            {
                Texture tex  = o as Texture;
                string  path = AssetDatabase.GetAssetPath(tex);
                string  name = o.name + (path != null ? " (" + path + ")" : "");
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("-", EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
                {
                    remove = tex;
                }
                EditorGUILayout.LabelField(name, EditorStyles.miniBoldLabel);
                EditorGUILayout.EndHorizontal();
                Vector2 size = GUIUtil.Resize(new Vector2(tex.width, tex.height), MAX_SIZE);
                EditorGUILayout.ObjectField(o, o.GetType(), false, GUILayout.Width(size.x), GUILayout.Height(size.y));
            }
            if (remove != null)
            {
                found.Remove(remove);
            }
        }
Beispiel #2
0
        //GUI的渲染(为了不迷惑,就不叫OnGUI了)
        public void RenderGUI()
        {
            if (m_IsLookingAtObject)
            {
                //显示持续按键的进度条
                if (m_IsPressingKey)
                {
                    GUIUtil.DisplaySubtitleInGivenGrammar(m_PlayerInteractingPromptText, Room5.GetCameraUtil.GetCurrentCamera(), 0.5f);

                    //进度条
                    float barWidth = 200.0f;
                    float halfW    = Room5.GetCameraUtil.GetCurrentCamera().pixelWidth / 2;
                    float halfH    = Room5.GetCameraUtil.GetCurrentCamera().pixelHeight / 2;
                    Rect  rect2    = new Rect();
                    rect2.xMin = halfW - barWidth / 2;
                    rect2.xMax = rect2.xMin + barWidth * (m_CurrentKeyPressedTime / m_RequiredKeyPressPersistTime);
                    rect2.yMin = halfH + 30.0f;
                    rect2.yMax = halfH + 40.0f;
                    GUI.DrawTexture(rect2, m_TextureGrey);
                }
                else
                {
                    GUIUtil.DisplaySubtitleInGivenGrammar(m_PlayerLookingPromptText, Room5.GetCameraUtil.GetCurrentCamera(), 0.5f);
                }
            }
        }
 public override void InitView()
 {
     img1  = GUIUtil.Find <Image>(this, "Canvas/img1");
     btn1  = GUIUtil.Find(this, "Canvas/btn1");
     node1 = GUIUtil.Find(this, "Canvas/node1");
     Debug.Log("init 1");
 }
Beispiel #4
0
        protected override void OnGUIInternal()
        {
            using (var h = new GUILayout.HorizontalScope())
            {
                using (var v = new GUILayout.VerticalScope(GUILayout.MinWidth(300f)))
                {
                    _miscFolds.OnGUI();
                    _dynamicFoldEnable = GUILayout.Toggle(_dynamicFoldEnable, "DynamicFold");
                    _dynamicFolds.OnGUI();
                    _int = GUIUtil.IntButton(_int, "IntButton");

                    GUIUtil.Indent(() =>
                    {
                        GUILayout.Label("Indent");
                    });

                    using (var cs = new GUIUtil.ColorScope(Color.green))
                    {
                        GUILayout.Label("ColorScope");
                    }
                }

                _fieldFolds.OnGUI();
                _sliderFolds.OnGUI();
            }
        }
Beispiel #5
0
        public void DebugMenu()
        {
            isEnable = GUILayout.Toggle(isEnable, "PreRendering");

            var enable = _preRendering.enabled;

            if (enable)
            {
                GUIUtil.Indent(() =>
                {
                    var data         = _preRendering.data;
                    data.passthrough = GUILayout.Toggle(data.passthrough, "PassThrough");

                    GUI.enabled = !autoDelay;
                    data.delay  = GUIUtil.Slider(data.delay, "Delay");
                    GUI.enabled = true;

                    autoDelay = GUILayout.Toggle(autoDelay, "AutoDelay");
                    if (autoDelay)
                    {
                        autoDelayOffset = GUIUtil.Slider(autoDelayOffset, -1f, 1f, "AutoDelayOffset");
                    }
                });
            }
        }
 public virtual System.Collections.IEnumerator Execute()
 {
     ActionNode154_obj   = Group.gameObject;
     ActionNode154_state = BoolNode156;
     // ActionNode
     while (this.DebugInfo("", "d71fc2ae-16f0-41d1-af16-88375cbe2dab", this) == 1)
     {
         yield return(null);
     }
     // Visit GameObjectUtils.setActive
     GameObjectUtils.setActive(ActionNode154_obj, ActionNode154_state);
     // ActionNode
     while (this.DebugInfo("d71fc2ae-16f0-41d1-af16-88375cbe2dab", "734a2d75-25f8-4a85-8050-eecccaecf737", this) == 1)
     {
         yield return(null);
     }
     // Visit GUIUtil.OpenMenu
     GUIUtil.OpenMenu();
     // SetVariableNode
     while (this.DebugInfo("734a2d75-25f8-4a85-8050-eecccaecf737", "13f67d59-c7bd-4904-a080-15ea16f8fcf6", this) == 1)
     {
         yield return(null);
     }
     Group.isVisible = (System.Boolean)BoolNode156;
     yield break;
 }
Beispiel #7
0
        public void OnGUI(Action <T> elementGUI, Func <T> createNewElement = null, string label = null)
        {
            GUILayout.Label(label ?? key);
            GUIUtil.Indent(() =>
            {
                var list = Get() ?? new List <T>();
                list.ForEach(elem =>
                {
                    using (var h = new GUILayout.HorizontalScope())
                    {
                        elementGUI(elem);
                    }
                });

                using (var h = new GUILayout.HorizontalScope())
                {
                    if (GUILayout.Button("Add"))
                    {
                        var elem = (createNewElement != null) ? createNewElement() : Activator.CreateInstance <T>();
                        list.Add(elem);
                    }
                    if (GUILayout.Button("Remove"))
                    {
                        list.RemoveAt(list.Count - 1);
                    }

                    Set(list);
                    OnGUIDefaultButton();
                }
            });
        }
        Rect GetWinPos(ConfigNode settings, string winName, float width, float height, bool initialScaled = true)
        {
            double x = (Screen.width - width) / 2;
            double y = (Screen.height - height) / 2;
            Rect   r;

            Log.Info("GetWinPos, winName: " + winName);
            if (settings != null && settings.HasValue(winName + "X"))
            {
                var x1 = Double.Parse(SafeLoad(settings.GetValue(winName + "X"), x));
                var y1 = Double.Parse(SafeLoad(settings.GetValue(winName + "Y"), y));
                if (x1 > 0)
                {
                    x = x1 - 1;
                }
                if (y1 > 0)
                {
                    y = y1 - 1;
                }

                r = new Rect((float)x, (float)y, (float)width, (float)height);
            }
            else
            {
                Log.Info("GetWinPos,centering window");
                r = GUIUtil.ScreenCenteredRect(width, height);
            }

            return(r);
        }
 public virtual System.Collections.IEnumerator Execute()
 {
     ActionNode157_obj   = Group.gameObject;
     ActionNode157_state = BoolNode158;
     // ActionNode
     while (this.DebugInfo("fa8d044e-dfc4-489d-a365-7c4b08bc0a19", "214a8a05-5f19-40a6-8659-3bb971dc58c0", this) == 1)
     {
         yield return(null);
     }
     // Visit GameObjectUtils.setActive
     GameObjectUtils.setActive(ActionNode157_obj, ActionNode157_state);
     // ActionNode
     while (this.DebugInfo("214a8a05-5f19-40a6-8659-3bb971dc58c0", "b760011d-5ce6-4991-82c8-74bbccd1f706", this) == 1)
     {
         yield return(null);
     }
     // Visit GUIUtil.CloseMenu
     GUIUtil.CloseMenu();
     // SetVariableNode
     while (this.DebugInfo("b760011d-5ce6-4991-82c8-74bbccd1f706", "afbc5001-5e11-44c9-bc89-603a26360905", this) == 1)
     {
         yield return(null);
     }
     Group.isVisible = (System.Boolean)BoolNode158;
     yield break;
 }
Beispiel #10
0
        private static void LTextGUI(string lable, ConstValue constValue)
        {
            var lText = (LText)constValue.RawValue;

            GUILayout.BeginHorizontal();

            string text;
            bool   isConst = lText.IsConst;

            if (lText.IsConst)
            {
                text = EditorGUILayout.TextField(lable, lText.ToString());
                if (GUILayout.Button("L", EditorStyles.miniButtonRight, GUILayout.Width(20)))
                {
                    isConst = false;
                }
            }
            else
            {
                text = GUIUtil.LanguageField(lable, lText.Text);
                if (GUILayout.Button("X", EditorStyles.miniButtonRight, GUILayout.Width(20)))
                {
                    isConst = true;
                }
            }

            if (text != lText.Text || isConst != lText.IsConst)
            {
                lText.Text    = text;
                lText.IsConst = isConst;
                constValue.Serialize();
            }

            GUILayout.EndHorizontal();
        }
Beispiel #11
0
    static void OnGUI()
    {
        if (!showGUI)
        {
            if (onGUICloseCallback != null)
            {
                onGUICloseCallback();
            }
            return;
        }

        GUIUtil.SetGUIStyle();

        if (onGUICallback != null)
        {
            onGUICallback();
        }

        windowRect = new Rect(margin + Screen.width * 0.2f,
                              margin,
                              Screen.width * 0.8f - (2 * margin),
                              Screen.height - (2 * margin));

        GUILayout.Window(100, windowRect, ConsoleWindow, "Console");
    }
Beispiel #12
0
 public override void OnTitleBarGUI()
 {
     if (GUIUtil.HelpIcon())
     {
         Product.OpenDocumentationPage();
     }
 }
        void OnGUI()
        {
            switch (m_SceneDirector.GetCameraState())
            {
            case SceneDirector.CameraState.ROAMING:

                break;

            case SceneDirector.CameraState.THIRD_PERSON:
                GUIUtil.DisplayMissionTargetInMessSequently("任务完成,返回基地.", m_CamFree, Color.white, 0.1f);
                string[] subtitles =
                {
                    "",    //等几秒先
                    "^g蓝星陆战队^w:指挥部,已取回托卡马克之心",
                    "^g蓝星陆战队^w:陆战队所有成员均已登上逃生舱,任务完成",
                    "^g地球指挥部^w:收到,尽快返回海神号。",
                };

                float[] subtitleTime = { 8.3f, 2.5f, 4.0f, 3.0f };
                float[] intervals    = { 0, 0.5f, 4.5f, 1.5f };
                GUIUtil.DisplaySubtitlesInGivenGrammarWithTimeStamp(
                    subtitles, m_CamFree, GUIUtil.DefaultFontSize, GUIUtil.DefaultSubtitleRatioHeight, subtitleTime, intervals);

                break;

            case SceneDirector.CameraState.LOOKING_AT_KUN:

                break;

            case SceneDirector.CameraState.VIDEO:

                break;
            }
        }
Beispiel #14
0
        private static void GenerateSupport(bool miniLabel)
        {
            var supportStyle = miniLabel
                   ? _miniSupportStyle
                   : _supportStyle;

            var linkStyle = miniLabel
                    ? _miniLinkStyle
                    : _linkStyle;

            GUILayout.Label("Support & Feedback: ", supportStyle.Get);

            if (GUIUtil.LinkLabel(Labels.ChatSupport, linkStyle.Get))
            {
                Product.OpenChatSupport();
            }

            GUILayout.Label(" / ", supportStyle.Get);

            if (GUIUtil.LinkLabel(Labels.EmailSupport, linkStyle.Get))
            {
                Product.OpenEmailSupport();
            }

            GUILayout.Label(" / ", supportStyle.Get);

            if (GUIUtil.LinkLabel(Labels.FormSupport, linkStyle.Get))
            {
                Product.OpenContactFormSupport();
            }
        }
Beispiel #15
0
        public static void Generate(bool miniLabel)
        {
            _version = _version ?? new VersionFetcher().Version;

            EditorGUILayout.BeginHorizontal();

            var linkStyle = miniLabel
                    ? _miniLinkStyle
                    : _linkStyle;

            if (GUIUtil.LinkLabel(Labels.ProductTitle, linkStyle.Get))
            {
                Product.OpenHomePage();
            }

            var versionStyle = miniLabel
                    ? _miniVersionStyle
                    : _versionStyle;

            GUILayout.Label($"v{_version}", versionStyle.Get);

            GUILayout.FlexibleSpace();

            GenerateSupport(miniLabel);

            EditorGUILayout.EndHorizontal();
        }
        private void OnGUI()
        {
            if (m_ReactorCore != null)
            {
                GUIUtil.DisplayMissionTargetDefault("夺回托卡马克之心.", Room5.GetCameraUtil.GetCurrentCamera(), Color.white);
                GUIUtil.DisplayMissionPoint(m_ReactorCore.transform.position, GetCameraUtil.GetCurrentCamera(), Color.white, labelOffsetHeight: 5.0f);
            }
            else
            {
                GUIUtil.DisplayMissionTargetDefault("逃离中央控制室.", Room5.GetCameraUtil.GetCurrentCamera(), Color.white);
                GUIUtil.DisplayMissionPoint(m_EnterNextSceneCube.transform.position, GetCameraUtil.GetCurrentCamera(), Color.white);
            }

            //播放 音效断电+"拿上核心"
            if (m_ReactorCore != null && m_isCoreCloseAudioPlayed)
            {
                //字幕
                string[] subtitles   = { "", "^g队长^w:拿上核心,准备撤退", };
                float[]  lastingTime = { 4.6f, 1.6f };
                float[]  intervals   = { 0.0f, 0.0f };
                GUIUtil.DisplaySubtitlesInGivenGrammarWithTimeStamp(subtitles, GetCameraUtil.GetCurrentCamera(), 20, 0.9f, lastingTime, intervals);
            }

            //拿到核心,"撤退”
            if (m_ReactorCore == null && m_isEvacuateAudioPlayed)
            {
                //字幕
                string[] subtitles   = { "^g队长^w:鲲的自毁程序即将启动,动作快一点!" };
                float[]  lastingTime = { 2.6f };
                float[]  intervals   = { 0.0f };
                GUIUtil.DisplaySubtitlesInGivenGrammarWithTimeStamp(subtitles, GetCameraUtil.GetCurrentCamera(), 20, 0.9f, lastingTime, intervals);
            }
        }
Beispiel #17
0
        public void Start()
        {
            _miscFold.Add("Fold0", () => { GUILayout.Label("Fold0"); });
            _miscFold.Add("Fold1", () => { GUILayout.Label("Fold1 FirstAdd"); });
            _miscFold.Add("Fold1", () => { GUILayout.Label("Fold1 SecondAdd"); });
            _miscFold.Add(-1, "FoldCustomOrder", () => { GUILayout.Label("FoldCustomOrder"); });
            _miscFold.Add("IDebugMenu", typeof(IDebugMenuSample));
            _dynamicFold.Add("DynamicFold", () => _dynamicFoldEnable, () => { GUILayout.Label("DynamicFold"); });

            _fieldFold.Add("Field", () =>
            {
                _enum    = GUIUtil.Field(_enum, "enum");
                _string  = GUIUtil.Field(_string, "string");
                _bool    = GUIUtil.Field(_bool, "bool");
                _int     = GUIUtil.Field(_int, "int");
                _float   = GUIUtil.Field(_float, "float");
                _vector2 = GUIUtil.Field(_vector2, "vector2");
                _vector3 = GUIUtil.Field(_vector3, "vector3");
                _vector4 = GUIUtil.Field(_vector4, "vector4");
                _rect    = GUIUtil.Field(_rect, "rect");
            });

            _fieldFold.Add("FieldWithUnparsedStr", () =>
            {
                _int     = GUIUtil.Field(_int, ref _intStr, "int");
                _float   = GUIUtil.Field(_float, ref _floatStr, "float");
                _vector2 = GUIUtil.Field(_vector2, ref _vector2Str, "vector2");
                _vector3 = GUIUtil.Field(_vector3, ref _vector3Str, "vector3");
                _vector4 = GUIUtil.Field(_vector4, ref _vector4Str, "vector4");
                _rect    = GUIUtil.Field(_rect, ref _rectStr, "rect");
            },
                           true);

            _sliderFold.Add("Slider", () =>
            {
                _int   = GUIUtil.Slider(_int, 0, 100, "Slider(int)");
                _float = GUIUtil.Slider(_float, "Slider(float)");
                using (var h = new GUILayout.HorizontalScope())
                {
                    GUILayout.Label("hoge");
                    GUILayout.HorizontalSlider(0f, 0f, 1f, GUILayout.MinWidth(200f));
                    GUILayout.TextField("hoge", GUILayout.MaxWidth(100f));
                }
                _vector2 = GUIUtil.Slider(_vector2, Vector2.zero, Vector2.one, "Slider(Vector2)");
                _vector3 = GUIUtil.Slider(_vector3, Vector3.zero, Vector3.one, "Slider(Vector3)");
                _vector4 = GUIUtil.Slider(_vector4, Vector4.zero, Vector4.one, "Slider(Vector4)");
                _rect    = GUIUtil.Slider(_rect, Rect.zero, new Rect(1f, 1f, 1f, 1f), "Slider(Rect)");
            });

            _sliderFold.Add("SliderWithUnparsedStr", () =>
            {
                _int     = GUIUtil.Slider(_int, 0, 100, ref _intStr, "Slider(int)");
                _float   = GUIUtil.Slider(_float, ref _floatStr, "Slider(float)");
                _vector2 = GUIUtil.Slider(_vector2, Vector2.zero, Vector2.one, ref _vector2Str, "Slider(Vector2)");
                _vector3 = GUIUtil.Slider(_vector3, Vector3.zero, Vector3.one, ref _vector3Str, "Slider(Vector3)");
                _vector4 = GUIUtil.Slider(_vector4, Vector4.zero, Vector4.one, ref _vector4Str, "Slider(Vector4)");
                _rect    = GUIUtil.Slider(_rect, Rect.zero, new Rect(1f, 1f, 1f, 1f), ref _rectStr, "Slider(Rect)");
            },
                            true);
        }
Beispiel #18
0
    void OnGUI()
    {
        Algorithm otherAlgorithm = (visualizedAlgorithm == floodFillAlgorithm)? (Algorithm)recursiveAlgorithm :(Algorithm)floodFillAlgorithm;

        // Draw
        GUI.Label(new Rect(Screen.width * 0.85f, 60, 400, 20), "Recursive Visit: " + recursiveVisitTime.Ticks + " ticks");
        GUI.Label(new Rect(Screen.width * 0.85f, 80, 400, 20), "Flood Fill: " + floodFillTime.Ticks + " ticks");

        GUI.Label(new Rect(Screen.width * 0.85f - 22, 120, 200, 20), visualizedAlgorithm.Name);

        GUI.Label(new Rect(Screen.width * 0.85f, 140, 400, 20), visualizedAlgorithm.HeatMapRedValue);
        GUI.Label(new Rect(Screen.width * 0.85f, 170, 400, 20), visualizedAlgorithm.HeatMapGreenValue);
        GUIUtil.GUIDrawRect(new Rect(Screen.width * 0.85f - 22, 140, 20, 20), Color.red);
        GUIUtil.GUIDrawRect(new Rect(Screen.width * 0.85f - 22, 170, 20, 20), Color.green);

        if (GUI.Button(new Rect(Screen.width * 0.85f - 50, 200, 200, 50), "Swap to " + otherAlgorithm.Name))
        {
            visualizedAlgorithm = otherAlgorithm;
            DrawMap();
        }

        if (GUI.Button(new Rect(Screen.width * 0.85f - 50, 260, 200, 50), "Regenerate map (space)"))
        {
            GenerateNewMap();
        }
    }
Beispiel #19
0
    static void OnGUI()
    {
        if (!showGUI)
        {
            return;
        }

        GUIUtil.SetGUIStyle();

        if (onGUICallback != null)
        {
            onGUICallback();
        }

        //if (GUI.Button (new Rect (100, 100, 200, 100), "清空数据")) {
        //    PlayerPrefs.DeleteAll ();
        //    #if UNITY_EDITOR
        //    EditorApplication.isPlaying = false;
        //    #else
        //    Application.Quit();
        //    #endif
        //}
        windowRect = new Rect(margin + Screen.width * 0.5f,
                              margin,
                              Screen.width * 0.5f - (2 * margin),
                              Screen.height - (2 * margin));

        GUILayout.Window(100, windowRect, ConsoleWindow, "Console");
    }
Beispiel #20
0
        // Called by NGUI
        void OnHover(bool isOver)
        {
            if (isOver)
            {
                GUIUtil.SetCursorTexture(OnHoverCursor);
            }
            else
            {
                GUIUtil.SetCursorToDefault();
            }

            if (!Texture)
            {
                return;
            }

            if (isOver)
            {
                Texture.color = HoverColor;
            }
            else
            {
                Texture.color = NormalColor;
            }
        }
Beispiel #21
0
    public void Draw()
    {
        if (TimeStart > 0f)
        {
            float num = Time.realtimeSinceStartup - TimeStart - TransferDelay;
            if (num > 0f && TransferStateNum < TransferTimer.Length)
            {
                if (TransferStateNum == -1 || TransferTimer[TransferStateNum] == 0f)
                {
                    TransferStateNum++;
                }
                if (TransferStateNum < TransferTimer.Length)
                {
                    TransferTimer[TransferStateNum] -= Time.deltaTime;
                    if (TransferTimer[TransferStateNum] <= 0f)
                    {
                        TransferTimer[TransferStateNum] = 0f;
                    }
                    TransferPercent = 1f - TransferTimer[TransferStateNum] / TransferTimes[TransferStateNum];
                }
            }
        }
        GUIUtil.OnDrawWindow();
        Rect myScreenRect = MyScreenRect;

        myScreenRect.x = QueueBattle.screenSpace.x + (QueueBattle.screenSpace.width - MyScreenRect.width) / 2f;
        myScreenRect.y = QueueBattle.screenSpace.y + (QueueBattle.screenSpace.height - MyScreenRect.height) / 2f;
        GUI.color      = new Color(1f, 1f, 1f, 0.85f);
        Rect position = new Rect(0f, 0f, QueueBattle.screenSpace.width, QueueBattle.screenSpace.height);

        GUI.Box(position, GUIContent.none, SharedSkin.GetStyle("blackbox"));
        GUI.color = Color.white;
        GUI.Window(123, myScreenRect, DrawScoreWindow, GUIContent.none, StatsSkin.window);
    }
        //bool initialPos = false;
        protected virtual void OnEnterToState(KFSMState kfsmState)
        {
            if (FlightGlobals.ActiveVessel == null)
            {
                return;
            }
            Log.Info("OnEnterToState: InitialState");
            if (FlightGlobals.ActiveVessel.situation != Vessel.Situations.PRELAUNCH)
            {
                Machine.RunEvent("Finish");
            }

            _obj               = new GameObject("Helper");
            _dummy             = _obj.AddComponent <DummyComponent>();
            StyleFactory.Scale = ConfigInfo.Instance.Scale;
            StyleFactory.Reload();

#if false
            if (!initialPos)
            {
                initialPos  = true;
                _windowRect = ScaleRect(GUIUtil.ScreenCenteredRect(459, 120));
            }
#else
            _windowRect = CountDownMain.saveLoadWinPos.initialWindow;
            //    CountDownMain.saveLoadWinPos.initialWindow;
            //if (!initialPos)
            //{
            //    initialPos = true;
            //    _windowRect = ScaleRect(_windowRect);
            //}
#endif
        }
        //onGUI在每帧被渲染之后执行
        private void OnGUI()
        {
            try
            {
                // 显示任务目标

                if (missionContent != string.Empty)
                {
                    GUIUtil.DisplayMissionTargetInMessSequently(missionContent,
                                                                Util.GetCamera(),
                                                                missionTargetColor,
                                                                interval: appearInterval,
                                                                blingInterval: blingInterval,
                                                                fontSize: 16,
                                                                sequentClear: sequentClear);
                }
                GUIUtil.DisplayMissionPoint(
                    targetWorldPosition,
                    Util.GetCamera(),
                    GUIUtil.missionPointColor);
            }
            catch (Exception e)
            {
                Debug.Log("任务系统摄像头错误");
            }
        }
Beispiel #24
0
        public override bool OnGUI(string label = null)
        {
            if (isIDebugMenu)
            {
                OnGUI((element) => ((GUIUtil.IDebugMenu)element).DebugMenu(), label);
                return(false);
            }

            return(OnGUIStrandardStyle((string v, ref string unparsedStr) =>
            {
                string ret = null;
                string l = label ?? key;
                if (_customOnGUIFunc != null)
                {
                    GUILayout.Label(l);
                    GUIUtil.Indent(() => ret = ToInner(_customOnGUIFunc(ToOuter(v))));
                }
                else
                {
                    ret = GUIUtil.Field <string>(v, ref unparsedStr, l);
                }

                return ret;
            }));
        }
Beispiel #25
0
    static void MenuWindow(int windowID)
    {
        GUIUtil.SetGUIStyle();

        windowRect = new Rect(Screen.width * 0.2f, Screen.height * 0.05f, Screen.width * 0.6f, Screen.height * 0.9f);

        if (MenuStatus == DevMenuEnum.MainMenu)
        {
            GUIStyle fontStyle = new GUIStyle();
            fontStyle.normal.background = null;               //设置背景填充
            fontStyle.normal.textColor  = new Color(1, 0, 0); //设置字体颜色
            fontStyle.fontSize          = 50;                 //字体大小

            if (GUILayout.Button("正常启动", GUILayout.ExpandHeight(true)))
            {
                ChoseReplayMode(false);
            }

            if (GUILayout.Button("复盘模式", GUILayout.ExpandHeight(true)))
            {
                MenuStatus   = DevMenuEnum.Replay;
                FileNameList = GetRelpayFileNames();
            }

            if (GUILayout.Button("查看日志", GUILayout.ExpandHeight(true)))
            {
                MenuStatus   = DevMenuEnum.Log;
                FileNameList = LogOutPutThread.GetLogFileNameList();
            }
            if (GUILayout.Button("测试模式", GUILayout.ExpandHeight(true)))
            {
                GameManager.unlockAlllevels = true;
                ChoseReplayMode(false);
            }
        }
        else if (MenuStatus == DevMenuEnum.Replay)
        {
            scrollPos = GUILayout.BeginScrollView(scrollPos);

            for (int i = 0; i < FileNameList.Length; i++)
            {
                if (GUILayout.Button(FileNameList[i]))
                {
                    ChoseReplayMode(true, FileNameList[i]);
                }
            }

            GUILayout.EndScrollView();

            if (GUILayout.Button("返回上层"))
            {
                MenuStatus = DevMenuEnum.MainMenu;
            }
        }
        else if (MenuStatus == DevMenuEnum.Log)
        {
            LogGUI();
        }
    }
Beispiel #26
0
 public void OnGUI()
 {
     enable = GUILayout.Toggle(enable, name);
     if (enable)
     {
         GUIUtil.Vertical(() => draw(), "window");
     }
 }
Beispiel #27
0
 public bool OnGUISlider(float min, float max, string label = null)
 {
     return(OnGUIStrandardStyle((float v, ref string unparsedStr) =>
     {
         GUIUtil.PrefixLabel(label ?? key);
         return GUIUtil.Slider(v, min, max, ref unparsedStr);
     }));
 }
Beispiel #28
0
        protected override void OnGUIInternal()
        {
            _prefsEnum.OnGUI();
            _prefsString.OnGUI();
            _prefsInt.OnGUI();
            _prefsFloat.OnGUI();
            _prefsFloat.OnGUISlider();
            _prefsBool.OnGUI();
            _prefsVector2.OnGUI();
            _prefsVector2.OnGUISlider();
            _prefsVector3.OnGUI();
            _prefsVector3.OnGUISlider();
            _prefsVector4.OnGUI();
            _prefsVector4.OnGUISlider();
            _prefsVector2Int.OnGUI();
            _prefsVector2Int.OnGUISlider();
            _prefsVector3Int.OnGUI();
            _prefsVector3Int.OnGUISlider();
            _prefsRect.OnGUI();
            _prefsRect.OnGUISlider();
            _prefsColor.OnGUI();


            _prefsIPEndPoint.OnGUI();

            // return true if value was changed
            if (_prefsColor.OnGUISlider())
            {
                // use as native type
                Color color = _prefsColor;
                Debug.Log("Changed. " + color);
            }


            // PrefsList can call runtime element GUI
            _prefsList.OnGUI((element) =>
            {
                element.name     = GUIUtil.Field(element.name ?? "", "name");
                element.intValue = GUIUtil.IntButton(element.intValue, "intValue");
            },
                             "PrefsList runtime element GUI");


            _prefsList.OnGUI("PrefsList automaticaly call element.DebugMenu() if it is IDebugMenu");



            GUILayout.Label($"file path: {PrefsGUI.Wrapper.PrefsWrapperPathSelector.path}");

            if (GUILayout.Button("Save"))
            {
                Prefs.Save();
            }
            if (GUILayout.Button("DeleteAll"))
            {
                Prefs.DeleteAll();
            }
        }
Beispiel #29
0
    static void ShowLog()
    {
        scrollPos = GUILayout.BeginScrollView(scrollPos);

        try
        {
            GUIUtil.SafeTextArea(showContent);
        }
        catch (Exception e)
        {
            GUILayout.TextArea(e.ToString());
        }

        GUILayout.EndScrollView();

        if (URLManager.GetURL("LogUpLoadURL") != null)
        {
            if (GUILayout.Button("上传日志"))
            {
                HTTPTool.Upload_Request_Thread(URLManager.GetURL("LogUpLoadURL"), LogPath, UploadCallBack);
            }
        }
        else
        {
            GUILayout.Label("上传日志需要在 URLConfig -> LogUpLoadURL 配置上传目录");
        }

#if UNITY_ANDROID
        if (GUILayout.Button("导出到设备"))
        {
            try
            {
                string path = phonePath + LogName + ".txt";
                FileTool.CreatFilePath(path);
                File.Copy(LogPath, path, true);
                GUIUtil.ShowTips("复制成功");
            }
            catch (Exception e)
            {
                GUIUtil.ShowTips(e.ToString());
            }
        }
#endif

        if (GUILayout.Button("复制到剪贴板"))
        {
            TextEditor tx = new TextEditor();
            tx.text = showContent;
            tx.OnFocus();
            tx.Copy();
        }

        if (GUILayout.Button("返回上层"))
        {
            isShowLog = false;
        }
    }
Beispiel #30
0
        public void handleMouseUp()
        {
            Vector2 screenMousePos = GUIUtil.getScreenMousePos();

            if (this._showSearchDropdown && !this._searchDropdownBoundingRect.Contains(screenMousePos))
            {
                this._showSearchDropdown = false;
            }
        }