private void Gui_PLYDataList()
        {
            Rect Panel = new Rect(0f, 0f, 250f, 800f);

            GUILayout.BeginArea(Panel, new GUIContent("PLY Data List"), GUI.skin.window);

            GUILayout.BeginHorizontal();
            GUILayout.Label("Search", GUILayout.Width(60));
            SearchText = GUILayout.TextField(SearchText);
            GUILayout.EndHorizontal();

            ListScroll = GUILayout.BeginScrollView(ListScroll, false, true);

            for (int Index = 0; Index < PLYDataList.Count; ++Index)
            {
                string Name = MeshList[Index].name;

                if (ModGUI.NameSearch(Name, SearchText))
                {
                    bool flag2 = Index == SelectID;

                    if (GUILayout.Button(string.Format("ID : {0}\n{1}", Index, Name), (!flag2) ? "button" : "buttongreen", GUILayout.ExpandHeight(false)) && !flag2)
                    {
                        SelectID = Index;
                        GUISoundManager.GetSingleton().PlayBeep();
                    }
                }
            }

            GUILayout.EndScrollView();

            GUILayout.EndArea();
        }
Ejemplo n.º 2
0
        private bool Gui_1 <T>(List <string> NameList, List <T> ObjectList, ref T SelectObject, ref string Search, ref Vector2 Scroll) where T : UnityEngine.Object
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Search", GUILayout.Width(60));
            Search = GUILayout.TextField(Search);
            GUILayout.EndHorizontal();

            Scroll = GUILayout.BeginScrollView(Scroll, false, true);
            bool B = false;

            for (int Index = 0; Index < NameList.Count; ++Index)
            {
                string Name = NameList[Index];

                if (ModGUI.NameSearch(Name, Search))
                {
                    bool   Flag = SelectObject != ObjectList[Index];
                    string Text = string.Format("ID : {0}\n{1}", Index, Name);

                    if (GUILayout.Button(new GUIContent(Text), (Flag) ? "button" : "buttongreen", GUILayout.ExpandHeight(false)) && Flag)
                    {
                        SelectObject = ObjectList[Index];
                        B            = true;
                        GUISoundManager.GetSingleton().PlayBeep();
                    }
                }
            }

            GUILayout.EndScrollView();
            GUILayout.EndArea();

            return(B);
        }
Ejemplo n.º 3
0
 private void ResizeHandle2_MouseDown(GUIItem item, int button, Vector2 position)
 {
     _IsResizing = true;
     dragStart   = new Vector2(position.x, position.y);
     sizeStart   = new Vector2(_Parent.Rect.width, _Parent.Rect.height);
     ModGUI.RegisterResize(this);
 }
Ejemplo n.º 4
0
        public void ResizeEnd(Vector2 mousePosition)
        {
            _IsResizing = false;
            ModGUI.UnregisterResize(this);

            dragStart = Vector2.zero;
            sizeStart = Vector2.zero;
        }
Ejemplo n.º 5
0
    public void Update()
    {
        if (ModInput.GetButtonDown("FreeCam Toggle"))
        {
            IsEnabled = !IsEnabled;

            if (!IsEnabled)
            {
                Time.timeScale = 1f;

                FreeCamera.enabled = false;
                if (PrevCamera != null)
                {
                    PrevCamera.enabled = true;
                }
            }
            else
            {
                QualitySettings.lodBias         = 1f;
                QualitySettings.maximumLODLevel = 0;

                PrevCamera = Camera.main;
                if (PrevCamera != null)
                {
                    FreeCamera.transform.position    = PrevCamera.transform.position;
                    FreeCamera.transform.eulerAngles = new Vector3(0f, PrevCamera.transform.eulerAngles.y, 0f);
                    MouseLook.targetDirection        = PrevCamera.transform.rotation.eulerAngles;
                    MouseLook.mouseAbsolute          = Vector2.zero;
                    FreeCamera.fieldOfView           = PrevCamera.fieldOfView;
                    if (FreeCamera.fieldOfView < 10f)
                    {
                        FreeCamera.fieldOfView = 75f;
                    }
                    PrevCamera.enabled = false;
                }
                FreeCamera.enabled = true;

                if (CameraManager.Instance != null)
                {
                    ApplyDOFToFreeCam();
                }
            }

            ModLogger.Log("freecam", $"{(IsEnabled ? "Enabled" : "Disabled")} MAGIC CAMERA™ mode.");
        }

        if (IsEnabled && ModInput.GetButtonDown("FreeCam Light Toggle"))
        {
            IsFullBright = !IsFullBright;
        }
        if (!WasFullBright && IsFullBright)
        {
            OriginalAmbienceColor       = RenderSettings.ambientLight;
            RenderSettings.ambientLight = new Color(1f, 1f, 1f, 1f);
        }
        else if (WasFullBright && !IsFullBright)
        {
            RenderSettings.ambientLight = OriginalAmbienceColor;
        }
        WasFullBright = IsFullBright;

        if (CameraManager.Instance != null)
        {
            CameraManager.Instance.enabled = !IsEnabled;
        }

        GUIInfoGroup.Visible = IsEnabled && IsGUIVisible;

        if (_FreeCamera != null)
        {
            MouseLook.enabled = IsEnabled;
        }

        if (!IsEnabled)
        {
            return;
        }

        MouseLook.enabled = !ModGUI.MainGroup.Visible;

        if (ModInput.GetButtonDown("FreeCam GUI Toggle"))
        {
            IsGUIVisible = !IsGUIVisible;
        }
        if (ModInput.GetButtonDown("FreeCam Game GUI Toggle Ext"))
        {
            ModGUI.ToggleGameGUI();
        }

        /*
         * if (CameraManager.Instance != null) {
         *  FreeCamera.enabled = true;
         *  if (Camera.main != null && Camera.main != FreeCamera)
         *      ApplyDOFToFreeCam();
         * }
         */

        FreeCamera.enabled = true;

        Transform camt = FreeCamera.transform;

        Speed = Mathf.Max(0.01f, Speed + 0.01f * ModInput.GetAxis("FreeCam Move Speed"));
        if (ModInput.GetButton("FreeCam Move Speed Reset"))
        {
            Speed = DefaultSpeed;
        }

        float speed = Speed;

        if (ModInput.GetButton("FreeCam Run"))
        {
            speed *= 4f;
        }

        Vector3 dir = Vector3.zero;

        dir += camt.forward * ModInput.GetAxis("Vertical");

        float angleY = camt.rotation.eulerAngles.y;

        angleY = (angleY + 90f) / 180f * Mathf.PI;
        if (camt.rotation.eulerAngles.z == 180f)
        {
            angleY += Mathf.PI;
        }
        dir += new Vector3(Mathf.Sin(angleY), 0f, Mathf.Cos(angleY)) * ModInput.GetAxis("Horizontal");

        if (dir != Vector3.zero)
        {
            dir.Normalize();
            camt.position += dir * speed * SpeedF;
        }

        camt.position += Vector3.up * ModInput.GetAxis("FreeCam Y Movement") * speed * SpeedF;

        float timeScalePrev = Time.timeScale;

        Time.timeScale = Mathf.Clamp(Time.timeScale + ModInput.GetAxis("FreeCam Game Speed") * (
                                         Time.timeScale < 0.24999f ? 0.01f :
                                         Time.timeScale < 1.99999f ? 0.05f :
                                         Time.timeScale < 7.99999f ? 0.5f :
                                         Time.timeScale < 15.99999f ? 1f :
                                         4f
                                         ), 0f, 100f);

        if (ModInput.GetButton("FreeCam Game Speed Reset"))
        {
            Time.timeScale = 1f;
        }

        if (ModInput.GetButton("FreeCam Game Speed Freeze"))
        {
            Time.timeScale = 0f;
        }

        int scaleRound = Mathf.FloorToInt(Time.timeScale * 100f);

        if (Time.timeScale >= 0.25f && scaleRound % 10 == 9)
        {
            Time.timeScale = (scaleRound + 1) / 100f;
        }

        GUIInfoGameSpeed.Text = $"Game speed: {Mathf.FloorToInt(Time.timeScale * 100f)}%";
        GUIInfoMoveSpeed.Text = $"Movement speed: {(speed / DefaultSpeed * 100f).ToString("N0")}%";
        GUIInfoSceneName.Text = $"Scene (level): {SceneManager.GetActiveScene().name}";
        Vector3 pos = camt.position;
        Vector3 rot = camt.eulerAngles;

        GUIInfoPosition.Text = $"Position: {pos.x.ToString("0000.00")}, {pos.y.ToString("0000.00")}, {pos.z.ToString("0000.00")}";
        GUIInfoRotation.Text = $"Rotation: {rot.x.ToString("0000.00")}, {rot.y.ToString("0000.00")}, {rot.z.ToString("0000.00")}";
    }
        private void SetupGUI(GameObject mainMenuRight)
        {
            _SelectedScenario = null;

            _ScenarioWindow = new GUI.Window(ModGUI.GetWindowIndex(), "Scenarios")
            {
                IsDraggable  = true,
                IsResizeable = true,
                IsCloseable  = true,
                Rect         = new Rect((Screen.width / 2) - 200, (Screen.height / 2) - 200, 400, 400),
                Visible      = false,
                MinWidth     = 200,
                MinHeight    = 200
            };

            _ScenarioWindow.WindowClosed += _ScenarioWindow_WindowClosed;

            GUI.Group group = new GUI.Group(GUI.GUIItem.Direction.Vertical);
            _ScenarioWindow.Items.Add(group);

            GUI.Group group1 = new GUI.Group(GUI.GUIItem.Direction.Horizontal);
            group.Items.Add(group1);

            lstScenarios = new GUI.Group(GUI.GUIItem.Direction.Vertical);
            group1.Items.Add(lstScenarios);

            foreach (Scenario scenario in Scenarios)
            {
                GUI.Button btn = new GUI.Button(scenario.Name)
                {
                    Tag = scenario
                };
                btn.Clicked += ScenarioBtn_Clicked;
                lstScenarios.Items.Add(btn);
            }

            _ScenarioInfo = new GUI.Group(GUI.GUIItem.Direction.Vertical)
            {
                Visible = false
            };
            group1.Items.Add(_ScenarioInfo);

            _Name = new GUI.Label("");
            _ScenarioInfo.Items.Add(_Name);

            _Desc = new GUI.TextArea("")
            {
                IsEditable = false,
                IsRichText = true
            };
            _ScenarioInfo.Items.Add(_Desc);

            _ThumbNail = new GUI.Box("")
            {
                Visible   = false,
                MaxWidth  = 200,
                MaxHeight = 200
            };
            _ScenarioInfo.Items.Add(_ThumbNail);

            GUI.Group btnGroup = new GUI.Group(GUI.GUIItem.Direction.Horizontal);
            group.Items.Add(btnGroup);

            _CancelBtn          = new GUI.Button("Cancel");
            _CancelBtn.Clicked += CancelBtn_Clicked;
            btnGroup.Items.Add(_CancelBtn);

            btnGroup.Items.Add(new GUI.FlexibleSpace());

            _LoadBtn = new GUI.Button("Load")
            {
                IsEnabled = false
            };
            _LoadBtn.Clicked += LoadBtn_Clicked;
            btnGroup.Items.Add(_LoadBtn);
        }
Ejemplo n.º 7
0
        public override bool ExtraGUI()
        {
            Gui_MeshDataList();
            Gui_MaterialDataList();
            Vector3 NSV = Vector3.zero;
            Vector3 NPV = Vector3.zero;
            Vector3 NAV = Vector3.zero;

            Rect Panel1 = new Rect(500f, 100f, 780f, 550f);

            GUILayout.BeginArea(Panel1, "StereoscopicHologram", GUI.skin.window);
            GUILayout.Space(10);

            GUILayout.BeginHorizontal();
            bool Flag0 = GUILayout.Toggle(BlockIsOn, "Block On/Off", GUILayout.Width(160f));
            bool Flag1 = GUILayout.Toggle(MeshIsOn, "Mesh On/Off", GUILayout.Width(160f));
            bool Frag2 = GUILayout.Toggle(VertexColorIsOn, "Vertex Color On/Off");

            GUILayout.EndHorizontal();

            ModGUI.TextWidth = 80;
            ModGUI.DigitSlider();
            GUILayout.Space(10);
            NSV.x = ModGUI.HorizontalSlider("Scale X", Scale.x, -100, 100, true);
            NSV.y = ModGUI.HorizontalSlider("Scale Y", Scale.y, -100, 100, true);
            NSV.z = ModGUI.HorizontalSlider("Scale Z", Scale.z, -100, 100, true);
            NPV.x = ModGUI.HorizontalSlider("Position X", Position.x, -100, 100, true);
            NPV.y = ModGUI.HorizontalSlider("Position Y", Position.y, -100, 100, true);
            NPV.z = ModGUI.HorizontalSlider("Position Z", Position.z, -100, 100, true);
            NAV.x = Mathf.DeltaAngle(0, ModGUI.HorizontalSlider("Angle X", Angle.x, -180, 180, true));
            NAV.y = Mathf.DeltaAngle(0, ModGUI.HorizontalSlider("Angle Y", Angle.y, -180, 180, true));
            NAV.z = Mathf.DeltaAngle(0, ModGUI.HorizontalSlider("Angle Z", Angle.z, -180, 180, true));
            bool result = (GuiCommon.DisplayCloseButton((int)Panel1.width)) ? true : false;

            GUILayout.EndArea();

            if (BlockIsOn != Flag0 || MeshIsOn != Flag1)
            {
                BlockIsOn = Flag0;
                MeshIsOn  = Flag1;
                UpdateOnOff();
                SyncroniseDataUpLoad();
            }

            if (Scale != NSV || VertexColorIsOn != Frag2)
            {
                Scale           = NSV;
                VertexColorIsOn = Frag2;
                UpdateMesh();
                SyncroniseDataUpLoad();
            }

            if (Position != NPV || Angle != NAV)
            {
                Position = NPV;
                Angle    = NAV;
                UpdateTransform();
                SyncroniseDataUpLoad();
            }

            return(result);
        }