Пример #1
0
    public override void OnInspectorGUI()
    {
        MegaGrab mg = (MegaGrab)target;

#if UNITY_5 || UNITY_6 || UNITY_2017
#else
        EditorGUIUtility.LookLikeControls();
#endif
        mg.SrcCamera     = (Camera)EditorGUILayout.ObjectField("Source Camera", mg.SrcCamera, typeof(Camera), true);
        mg.GrabKey       = (KeyCode)EditorGUILayout.EnumPopup("Grab Key", mg.GrabKey);
        mg.grabFromStart = EditorGUILayout.Toggle("Grab From Start", mg.grabFromStart);
        mg.ResUpscale    = EditorGUILayout.IntField("Res Upscale", mg.ResUpscale);
        mg.CalcFromSize  = EditorGUILayout.BeginToggleGroup("Calc From Size", mg.CalcFromSize);
        mg.Dpi           = EditorGUILayout.IntField("Dpi", mg.Dpi);
        mg.Width         = EditorGUILayout.FloatField("Width", mg.Width);
        EditorGUILayout.EndToggleGroup();

        mg.OutputFormat = (IMGFormat)EditorGUILayout.EnumPopup("Output Format", mg.OutputFormat);

        if (mg.OutputFormat == IMGFormat.Tga)
        {
            mg.alphagrab    = EditorGUILayout.BeginToggleGroup("Alpha Grab", mg.alphagrab);
            mg.usemask      = EditorGUILayout.Toggle("Use Mask", mg.usemask);
            mg.alphamaskcol = EditorGUILayout.ColorField("Mask Col", mg.alphamaskcol);
            EditorGUILayout.EndToggleGroup();
        }
        else
        {
            mg.Quality = EditorGUILayout.Slider("Jpg Quality", mg.Quality, 0.0f, 100.0f);
        }

        mg.uploadGrabs = EditorGUILayout.BeginToggleGroup("Upload Grab", mg.uploadGrabs);
        mg.m_URL       = EditorGUILayout.TextField("Url", mg.m_URL);
        EditorGUILayout.EndToggleGroup();

        mg.sequenceGrab = EditorGUILayout.BeginToggleGroup("Sequence Grab", mg.sequenceGrab);
        mg.adddatetime  = EditorGUILayout.Toggle("Add Date Time", mg.adddatetime);
        mg.CancelKey    = (KeyCode)EditorGUILayout.EnumPopup("Cancel Key", mg.CancelKey);
        mg.framerate    = EditorGUILayout.IntField("FrameRate", mg.framerate);
        mg.grabTime     = EditorGUILayout.FloatField("Grab Time", mg.grabTime);

        EditorGUILayout.EndToggleGroup();

        EditorGUILayout.BeginVertical("Box");
        EditorGUILayout.LabelField("Number of Grabs " + mg.NumberOfGrabs);
        EditorGUILayout.LabelField("Estimated Time " + mg.EstimatedTime + "s");

        EditorWindow gameView = GetMainGameView();
        Rect         pos1     = gameView.position;

        if (mg.CalcFromSize)
        {
            mg.CalcUpscale((int)pos1.width, (int)pos1.height);
        }
        else
        {
            mg.GrabWidthWillBe  = (int)pos1.width * mg.ResUpscale;
            mg.GrabHeightWillBe = (int)pos1.height * mg.ResUpscale;
        }

        EditorGUILayout.LabelField("Grab Size " + mg.GrabWidthWillBe + " x " + mg.GrabHeightWillBe);
        EditorGUILayout.EndVertical();

        mg.UseCoroutine = EditorGUILayout.Toggle("Use Coroutine", mg.UseCoroutine);

        mg.Blur       = EditorGUILayout.FloatField("Blur", mg.Blur);
        mg.AASamples  = EditorGUILayout.IntField("AA Samples", mg.AASamples);
        mg.FilterMode = (AnisotropicFiltering)EditorGUILayout.EnumPopup("Filter Mode", mg.FilterMode);
        mg.UseJitter  = EditorGUILayout.Toggle("Use Jitter", mg.UseJitter);

        mg.SaveName = EditorGUILayout.TextField("Save Name", mg.SaveName);
        mg.Format   = EditorGUILayout.TextField("Format", mg.Format);
        mg.Enviro   = EditorGUILayout.TextField("Enviroment Var", mg.Enviro);
        mg.Path     = EditorGUILayout.TextField("Path", mg.Path);

        mg.UseDOF        = EditorGUILayout.BeginToggleGroup("Use DOF", mg.UseDOF);
        mg.focalDistance = EditorGUILayout.FloatField("Focal Distance", mg.focalDistance);
        mg.totalSegments = EditorGUILayout.IntField("Total Segments", mg.totalSegments);
        mg.sampleRadius  = EditorGUILayout.FloatField("Sample Radius", mg.sampleRadius);
        EditorGUILayout.EndToggleGroup();
        if (GUI.changed)
        {
            mg.CalcEstimate();
            EditorUtility.SetDirty(target);
        }
    }
Пример #2
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.F9))
     {
         if (PhotoModeCamera.instance != null)
         {
             PhotoModeCamera.instance.Destroy();
         }
         else
         {
             UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("PhotoMode"));
             PhotoModeCamera.instance.StopTime = true;
         }
     }
     if (Input.GetKeyDown(KeyCode.F8))
     {
         if (PhotoModeCamera.instance != null)
         {
             StageScript.Instance.AllowInput = true;
             PhotoModeCamera.instance.Destroy();
         }
         else
         {
             StageScript.Instance.AllowInput = false;
             UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("PhotoMode"));
             PhotoModeCamera.instance.StopTime = false;
         }
     }
     if (Input.GetKeyDown(KeyCode.F10))
     {
         GameObject gameObject = new GameObject();
         MegaGrab   megaGrab   = gameObject.AddComponent <MegaGrab>();
         megaGrab.SrcCamera        = Camera.main;
         megaGrab.SaveName         = "Capture";
         megaGrab.ResUpscale       = 2;
         megaGrab.AASamples        = 4;
         megaGrab.Quality          = 1f;
         megaGrab.Path             = Environment.CurrentDirectory;
         megaGrab.OutputFormat     = IMGFormat.Tga;
         megaGrab.GrabWidthWillBe  = 1920;
         megaGrab.GrabHeightWillBe = 1080;
         megaGrab.GrabKey          = KeyCode.None;
         megaGrab.DoScreenGrab();
         Debug.Log("Done Screenshot");
         UnityEngine.Object.Destroy(gameObject, 0.1f);
     }
     if (Input.inputString.Length > 0)
     {
         this.lastInput += Input.inputString.ToLower();
         if (this.lastInput.Length > 10)
         {
             this.lastInput = this.lastInput.Remove(0, this.lastInput.Length - 10);
         }
         if (this.lastInput.EndsWith("ravpic"))
         {
             this.Ravpic();
         }
         else if (this.lastInput.EndsWith("movie"))
         {
             this.Ravpic();
             this.Noise();
             this.Outline();
             this.StopTapes();
             this.Music();
         }
         else if (this.lastInput.EndsWith("shazam"))
         {
             StageScript.Instance.EndStage(StageScript.EndStageReasons.SurvivorsWon);
         }
         else if (this.lastInput.EndsWith("iddqd"))
         {
             ((SurvivorController)StageScript.Instance.LocalCharacter).Data.Die();
         }
         else if (this.lastInput.EndsWith("showtapes"))
         {
             foreach (GoalInstance goalInstance in StageScript.Instance.Goals)
             {
                 if (goalInstance != null && !goalInstance.IsCleared)
                 {
                     HighlighterHelper componentInChildren = goalInstance.GetComponentInChildren <HighlighterHelper>();
                     if (componentInChildren != null)
                     {
                         componentInChildren.ConstantOn(Color.white, 30f);
                     }
                 }
             }
         }
         else if (this.lastInput.EndsWith("sane"))
         {
             ((SurvivorController)StageScript.Instance.LocalCharacter).Data.Sanity.MaxOut();
         }
         else if (this.lastInput.EndsWith("terror"))
         {
             ((SurvivorController)StageScript.Instance.LocalCharacter).Data.Sanity.Progress = 0f;
         }
         else if (this.lastInput.EndsWith("outline"))
         {
             this.Outline();
         }
         else if (this.lastInput.EndsWith("asylum"))
         {
             foreach (SurvivorController survivorController in StageScript.Instance.Survivors)
             {
                 if (!survivorController.IsRemote && !survivorController.IsLocal)
                 {
                     survivorController.Data.Sanity.Value = 0f;
                 }
             }
         }
         else if (this.lastInput.EndsWith("stoptapes"))
         {
             this.StopTapes();
         }
         else if (this.lastInput.EndsWith("nomonster"))
         {
             StageScript.Instance.Monster.gameObject.SetActive(false);
         }
         else if (this.lastInput.EndsWith("flash"))
         {
             StageScript.Instance.Monster.Data.StartFlashed(null);
         }
         else if (this.lastInput.EndsWith("debug"))
         {
             GameObject original    = Resources.Load <GameObject>("UI/HUD/Debug");
             GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(original);
             gameObject2.transform.parent = PanelManager.Instance.transform;
             gameObject2.transform.Reset();
         }
         else if (this.lastInput.EndsWith("powerup"))
         {
             if (StageScript.Instance.LocalCharacter.IsSurvivor)
             {
                 SurvivorController survivorController2 = StageScript.Instance.LocalCharacter as SurvivorController;
                 survivorController2.ResetPowers();
             }
             else
             {
                 MonsterController monsterController = StageScript.Instance.LocalCharacter as MonsterController;
                 monsterController.Data.ResetPowers();
             }
         }
         else if (this.lastInput.EndsWith("catch"))
         {
             if (StageScript.Instance.LocalCharacter.IsSurvivor)
             {
                 SurvivorController survivorController3 = StageScript.Instance.LocalCharacter as SurvivorController;
                 StageScript.Instance.Monster.transform.position = survivorController3.transform.position - survivorController3.transform.forward * 1.2f * 0.9f;
             }
             else
             {
                 SurvivorController survivorController4 = StageScript.Instance.Survivors[0];
                 StageScript.Instance.Monster.transform.position = survivorController4.transform.position - survivorController4.transform.forward * 1.2f * 0.9f;
             }
         }
         else if (this.lastInput.EndsWith("getbot"))
         {
             SurvivorController survivorController5 = null;
             foreach (SurvivorController survivorController6 in StageScript.Instance.Survivors)
             {
                 if (survivorController6.Movement.IsBot && survivorController6.Data.IsAlive)
                 {
                     survivorController5 = survivorController6;
                     break;
                 }
             }
             if (survivorController5 != null)
             {
                 StageScript.Instance.Monster.transform.position = survivorController5.transform.position - survivorController5.transform.forward * 1.2f * 0.9f;
             }
         }
         else if (this.lastInput.EndsWith("noise"))
         {
             this.Noise();
         }
         else if (this.lastInput.EndsWith("nototems"))
         {
             foreach (Totem totem in StageScript.Instance.Totems)
             {
                 totem.gameObject.SetActive(false);
             }
             foreach (TotemSpawn totemSpawn in StageScript.Instance.TotemSpawnPreviews)
             {
                 totemSpawn.gameObject.SetActive(false);
             }
         }
         else if (this.lastInput.EndsWith("battery"))
         {
             SurvivorController survivorController7 = StageScript.Instance.LocalCharacter as SurvivorController;
             survivorController7.Data.BatteryLife.MaxOut();
             survivorController7.Data.FlashlightBattery.SetValue(100000f);
         }
         else if (this.lastInput.EndsWith("lowbat"))
         {
             SurvivorController survivorController8 = StageScript.Instance.LocalCharacter as SurvivorController;
             survivorController8.Data.BatteryLife.Progress = 0.15f;
             survivorController8.Data.FlashlightBattery.SetValue(100000f);
         }
         else if (this.lastInput.EndsWith("front"))
         {
             if (StageScript.Instance.LocalCharacter.IsSurvivor)
             {
                 SurvivorController survivorController9 = StageScript.Instance.LocalCharacter as SurvivorController;
                 StageScript.Instance.Monster.transform.position = survivorController9.transform.position + survivorController9.transform.forward * 18f + new Vector3(0f, 1.5f, 0f);
             }
             else
             {
                 SurvivorController survivorController10 = StageScript.Instance.Survivors[0];
                 StageScript.Instance.Monster.transform.position = survivorController10.transform.position - survivorController10.transform.forward * 18f + new Vector3(0f, 1.5f, 0f);
             }
         }
         else if (this.lastInput.EndsWith("reunite"))
         {
             EntityController localCharacter = StageScript.Instance.LocalCharacter;
             foreach (SurvivorController survivorController11 in StageScript.Instance.Survivors)
             {
                 if (!(survivorController11 == localCharacter))
                 {
                     Vector2 vector = UnityEngine.Random.insideUnitCircle * 2.5f;
                     survivorController11.transform.position = localCharacter.transform.position + localCharacter.transform.forward * 7.5f + new Vector3(0f, 1.5f, 0f) + new Vector3(vector.x, 0f, vector.y);
                 }
             }
         }
         else if (this.lastInput.EndsWith("speed"))
         {
             ((SurvivorController)StageScript.Instance.LocalCharacter).Data.Speed.SetValue(5f);
         }
         else if (this.lastInput.EndsWith("slow"))
         {
             ((SurvivorController)StageScript.Instance.LocalCharacter).Data.Speed.SetValue(1f);
         }
         else if (this.lastInput.EndsWith("killbot"))
         {
             SurvivorController survivorController12 = null;
             foreach (SurvivorController survivorController13 in StageScript.Instance.Survivors)
             {
                 if (survivorController13.Movement.IsBot && survivorController13.Data.IsAlive)
                 {
                     survivorController12 = survivorController13;
                     break;
                 }
             }
             if (survivorController12 != null)
             {
                 survivorController12.Data.Die();
             }
         }
         else if (this.lastInput.EndsWith("allclear"))
         {
             RenderSettings.ambientLight = Color.white;
             RenderSettings.ambientMode  = AmbientMode.Flat;
             RenderSettings.fogDensity   = 0f;
         }
         else if (this.lastInput.EndsWith("music"))
         {
             this.Music();
         }
     }
 }