Example #1
0
    public static void AvataTakeTempPhoto()
    {
        string filename = "TempPhoto.png";

        ScreenCapture.CaptureScreenshot(filename);
    }
Example #2
0
    /**
     * Take a screenshot and open it (Works in standalone only).
     */
    public void takeScreenshot()
    {
        string fileName = "screenshot-" + System.DateTime.Now.ToString("HH-mm-ss") + ".png";

        ScreenCapture.CaptureScreenshot(System.IO.Path.Combine(Application.persistentDataPath, fileName));
    }
    public void OnKeyDown(KButtonEvent e)
    {
        if (!enabled)
        {
            return;
        }
        if (e.TryConsume(Action.DebugSpawnMinion))
        {
            SpawnMinion();
        }
        else if (e.TryConsume(Action.DebugSpawnStressTest))
        {
            for (int i = 0; i < 60; i++)
            {
                SpawnMinion();
            }
        }
        else if (e.TryConsume(Action.DebugSuperTestMode))
        {
            if (!superTestMode)
            {
                Time.timeScale = 15f;
                superTestMode  = true;
            }
            else
            {
                Time.timeScale = 1f;
                superTestMode  = false;
            }
        }
        else if (e.TryConsume(Action.DebugUltraTestMode))
        {
            if (!ultraTestMode)
            {
                Time.timeScale = 30f;
                ultraTestMode  = true;
            }
            else
            {
                Time.timeScale = 1f;
                ultraTestMode  = false;
            }
        }
        else if (e.TryConsume(Action.DebugSlowTestMode))
        {
            if (!slowTestMode)
            {
                Time.timeScale = 0.06f;
                slowTestMode   = true;
            }
            else
            {
                Time.timeScale = 1f;
                slowTestMode   = false;
            }
        }
        else if (e.TryConsume(Action.DebugDig))
        {
            int mouseCell = GetMouseCell();
            SimMessages.Dig(mouseCell, -1);
        }
        else if (e.TryConsume(Action.DebugInstantBuildMode))
        {
            InstantBuildMode = !InstantBuildMode;
            if ((UnityEngine.Object)Game.Instance == (UnityEngine.Object)null)
            {
                return;
            }
            if ((UnityEngine.Object)PlanScreen.Instance != (UnityEngine.Object)null)
            {
                PlanScreen.Instance.Refresh();
            }
            if ((UnityEngine.Object)BuildMenu.Instance != (UnityEngine.Object)null)
            {
                BuildMenu.Instance.Refresh();
            }
            if ((UnityEngine.Object)OverlayMenu.Instance != (UnityEngine.Object)null)
            {
                OverlayMenu.Instance.Refresh();
            }
            if ((UnityEngine.Object)ConsumerManager.instance != (UnityEngine.Object)null)
            {
                ConsumerManager.instance.RefreshDiscovered(null);
            }
            if ((UnityEngine.Object)ManagementMenu.Instance != (UnityEngine.Object)null)
            {
                ManagementMenu.Instance.CheckResearch(null);
                ManagementMenu.Instance.CheckSkills(null);
                ManagementMenu.Instance.CheckStarmap(null);
            }
            Game.Instance.Trigger(1594320620, "all_the_things");
        }
        else if (e.TryConsume(Action.DebugExplosion))
        {
            Vector3 mousePos = KInputManager.GetMousePos();
            Vector3 position = Camera.main.transform.GetPosition();
            mousePos.z = 0f - position.z - Grid.CellSizeInMeters;
            Vector3 explosion_pos = Camera.main.ScreenToWorldPoint(mousePos);
            GameUtil.CreateExplosion(explosion_pos);
        }
        else if (e.TryConsume(Action.DebugLockCursor))
        {
            if (GenericGameSettings.instance.developerDebugEnable)
            {
                KInputManager.isMousePosLocked = !KInputManager.isMousePosLocked;
                KInputManager.lockedMousePos   = KInputManager.GetMousePos();
            }
        }
        else if (e.TryConsume(Action.DebugDiscoverAllElements))
        {
            if ((UnityEngine.Object)WorldInventory.Instance != (UnityEngine.Object)null)
            {
                foreach (Element element in ElementLoader.elements)
                {
                    WorldInventory.Instance.Discover(element.tag, element.GetMaterialCategoryTag());
                }
            }
        }
        else if (e.TryConsume(Action.DebugToggleUI))
        {
            ToggleScreenshotMode();
        }
        else if (e.TryConsume(Action.SreenShot1x))
        {
            string filename = Path.ChangeExtension(SaveLoader.GetActiveSaveFilePath(), ".png");
            ScreenCapture.CaptureScreenshot(filename, 1);
        }
        else if (e.TryConsume(Action.SreenShot2x))
        {
            string filename2 = Path.ChangeExtension(SaveLoader.GetActiveSaveFilePath(), ".png");
            ScreenCapture.CaptureScreenshot(filename2, 2);
        }
        else if (e.TryConsume(Action.SreenShot8x))
        {
            string filename3 = Path.ChangeExtension(SaveLoader.GetActiveSaveFilePath(), ".png");
            ScreenCapture.CaptureScreenshot(filename3, 8);
        }
        else if (e.TryConsume(Action.SreenShot32x))
        {
            string filename4 = Path.ChangeExtension(SaveLoader.GetActiveSaveFilePath(), ".png");
            ScreenCapture.CaptureScreenshot(filename4, 32);
        }
        else if (e.TryConsume(Action.DebugCellInfo))
        {
            DebugCellInfo = !DebugCellInfo;
        }
        else if (e.TryConsume(Action.DebugToggle))
        {
            if ((UnityEngine.Object)Game.Instance != (UnityEngine.Object)null)
            {
                Game.Instance.UpdateGameActiveRegion(0, 0, Grid.WidthInCells, Grid.HeightInCells);
                SaveGame.Instance.worldGenSpawner.SpawnEverything();
            }
            if ((UnityEngine.Object)DebugPaintElementScreen.Instance != (UnityEngine.Object)null)
            {
                bool activeSelf = DebugPaintElementScreen.Instance.gameObject.activeSelf;
                DebugPaintElementScreen.Instance.gameObject.SetActive(!activeSelf);
                if ((bool)DebugElementMenu.Instance && DebugElementMenu.Instance.root.activeSelf)
                {
                    DebugElementMenu.Instance.root.SetActive(false);
                }
                DebugBaseTemplateButton.Instance.gameObject.SetActive(!activeSelf);
                PropertyTextures.FogOfWarScale = (float)((!activeSelf) ? 1 : 0);
                if ((UnityEngine.Object)CameraController.Instance != (UnityEngine.Object)null)
                {
                    CameraController.Instance.EnableFreeCamera(!activeSelf);
                }
            }
        }
        else if (e.TryConsume(Action.DebugCollectGarbage))
        {
            GC.Collect();
        }
        else if (e.TryConsume(Action.DebugInvincible))
        {
            InvincibleMode = !InvincibleMode;
        }
        else if (e.TryConsume(Action.DebugVisualTest))
        {
            Scenario.Instance.SetupVisualTest();
        }
        else if (e.TryConsume(Action.DebugGameplayTest))
        {
            Scenario.Instance.SetupGameplayTest();
        }
        else if (e.TryConsume(Action.DebugElementTest))
        {
            Scenario.Instance.SetupElementTest();
        }
        else if (e.TryConsume(Action.ToggleProfiler))
        {
            Sim.SIM_HandleMessage(-409964931, 0, null);
        }
        else if (e.TryConsume(Action.DebugRefreshNavCell))
        {
            Pathfinding.Instance.RefreshNavCell(GetMouseCell());
        }
        else if (e.TryConsume(Action.DebugToggleSelectInEditor))
        {
            SetSelectInEditor(!SelectInEditor);
        }
        else if (e.TryConsume(Action.DebugGotoTarget))
        {
            Debug.Log("Debug GoTo");
            Game.Instance.Trigger(775300118, null);
            foreach (Brain item in Components.Brains.Items)
            {
                item.GetSMI <DebugGoToMonitor.Instance>()?.GoToCursor();
                item.GetSMI <CreatureDebugGoToMonitor.Instance>()?.GoToCursor();
            }
        }
        else if (e.TryConsume(Action.DebugTeleport))
        {
            if ((UnityEngine.Object)SelectTool.Instance == (UnityEngine.Object)null)
            {
                return;
            }
            KSelectable selected = SelectTool.Instance.selected;
            if ((UnityEngine.Object)selected != (UnityEngine.Object)null)
            {
                int mouseCell2 = GetMouseCell();
                if (!Grid.IsValidBuildingCell(mouseCell2))
                {
                    PopFXManager.Instance.SpawnFX(PopFXManager.Instance.sprite_Negative, UI.DEBUG_TOOLS.INVALID_LOCATION, null, GetMousePos(), 1.5f, false, true);
                    return;
                }
                selected.transform.SetPosition(Grid.CellToPosCBC(mouseCell2, Grid.SceneLayer.Move));
            }
        }
        else if (!e.TryConsume(Action.DebugPlace) && !e.TryConsume(Action.DebugSelectMaterial))
        {
            if (e.TryConsume(Action.DebugNotification))
            {
                if (GenericGameSettings.instance.developerDebugEnable)
                {
                    Tutorial.Instance.DebugNotification();
                }
            }
            else if (e.TryConsume(Action.DebugNotificationMessage))
            {
                if (GenericGameSettings.instance.developerDebugEnable)
                {
                    Tutorial.Instance.DebugNotificationMessage();
                }
            }
            else if (e.TryConsume(Action.DebugSuperSpeed))
            {
                if ((UnityEngine.Object)SpeedControlScreen.Instance != (UnityEngine.Object)null)
                {
                    SpeedControlScreen.Instance.ToggleRidiculousSpeed();
                }
            }
            else if (e.TryConsume(Action.DebugGameStep))
            {
                if ((UnityEngine.Object)SpeedControlScreen.Instance != (UnityEngine.Object)null)
                {
                    SpeedControlScreen.Instance.DebugStepFrame();
                }
            }
            else if (e.TryConsume(Action.DebugSimStep))
            {
                Game.Instance.ForceSimStep();
            }
            else if (e.TryConsume(Action.DebugToggleMusic))
            {
                AudioDebug.Get().ToggleMusic();
            }
            else if (e.TryConsume(Action.DebugRiverTest))
            {
                Scenario.Instance.SetupRiverTest();
            }
            else if (e.TryConsume(Action.DebugTileTest))
            {
                Scenario.Instance.SetupTileTest();
            }
            else if (e.TryConsume(Action.DebugForceLightEverywhere))
            {
                PropertyTextures.instance.ForceLightEverywhere = !PropertyTextures.instance.ForceLightEverywhere;
            }
            else if (e.TryConsume(Action.DebugPathFinding))
            {
                DebugPathFinding = !DebugPathFinding;
                Debug.Log("DebugPathFinding=" + DebugPathFinding);
            }
            else if (!e.TryConsume(Action.DebugFocus))
            {
                if (e.TryConsume(Action.DebugReportBug))
                {
                    if (GenericGameSettings.instance.developerDebugEnable)
                    {
                        int    num = 0;
                        string validSaveFilename;
                        while (true)
                        {
                            validSaveFilename = SaveScreen.GetValidSaveFilename("bug_report_savefile_" + num.ToString());
                            if (!File.Exists(validSaveFilename))
                            {
                                break;
                            }
                            num++;
                        }
                        string save_file = "No save file (front end)";
                        if ((UnityEngine.Object)SaveLoader.Instance != (UnityEngine.Object)null)
                        {
                            save_file = SaveLoader.Instance.Save(validSaveFilename, false, false);
                        }
                        KCrashReporter.ReportBug("Bug Report", save_file);
                    }
                    else
                    {
                        Debug.Log("Debug crash keys are not enabled.");
                    }
                }
                else if (e.TryConsume(Action.DebugTriggerException))
                {
                    if (GenericGameSettings.instance.developerDebugEnable)
                    {
                        string     str        = Guid.NewGuid().ToString();
                        StackTrace stackTrace = new StackTrace(1, true);
                        str = str + "\n" + stackTrace.ToString();
                        KCrashReporter.ReportError("Debug crash with random stack", str, null, ScreenPrefabs.Instance.ConfirmDialogScreen, string.Empty);
                    }
                }
                else if (e.TryConsume(Action.DebugTriggerError))
                {
                    if (GenericGameSettings.instance.developerDebugEnable)
                    {
                        Debug.LogError("Oooops! Testing error!");
                    }
                }
                else if (e.TryConsume(Action.DebugDumpGCRoots))
                {
                    GarbageProfiler.DebugDumpRootItems();
                }
                else if (e.TryConsume(Action.DebugDumpGarbageReferences))
                {
                    GarbageProfiler.DebugDumpGarbageStats();
                }
                else if (e.TryConsume(Action.DebugDumpEventData))
                {
                    if (GenericGameSettings.instance.developerDebugEnable)
                    {
                        KObjectManager.Instance.DumpEventData();
                    }
                }
                else if (e.TryConsume(Action.DebugDumpSceneParitionerLeakData))
                {
                    if (!GenericGameSettings.instance.developerDebugEnable)
                    {
                        goto IL_0b5e;
                    }
                }
                else if (e.TryConsume(Action.DebugCrashSim))
                {
                    if (GenericGameSettings.instance.developerDebugEnable)
                    {
                        Sim.SIM_DebugCrash();
                    }
                }
                else if (e.TryConsume(Action.DebugNextCall))
                {
                    DebugNextCall = true;
                }
                else if (e.TryConsume(Action.DebugTogglePersonalPriorityComparison))
                {
                    Chore.ENABLE_PERSONAL_PRIORITIES = !Chore.ENABLE_PERSONAL_PRIORITIES;
                }
            }
        }
        goto IL_0b5e;
IL_0b5e:
        if (e.Consumed && (UnityEngine.Object)Game.Instance != (UnityEngine.Object)null)
        {
            Game.Instance.debugWasUsed  = true;
            KCrashReporter.debugWasUsed = true;
        }
    }
Example #4
0
    //Take a screenshot
    public void TakeScreenshot(string name)
    {
        string path = "c:\\Nerladdat\\Temp\\" + name;

        ScreenCapture.CaptureScreenshot(path);
    }
Example #5
0
 public void OnClick()
 {
     ScreenCapture.CaptureScreenshot("Capturas/Captura" + System.DateTime.Now.Millisecond + ".png");
 }
    void moveAgents()
    {
        if (!animate)
        {
            return;
        }

        for (int i = 0; i < numAgents_; i++)
        {
            if (!showTargets)
            {
                targetAgents_[i].SetActive(false);
            }

            if (timestep >= agents_[i].pos.Count)
            {
                continue;
            }

            walkerAgents_[i].transform.SetPositionAndRotation(agents_[i].pos[timestep], Quaternion.identity);
            walkerAgents_[i].transform.forward = agents_[i].getForward(timestep);
            targetAgents_[i].transform.SetPositionAndRotation(agents_[i].tar[timestep], Quaternion.identity);

            List <Vector3> poss = new List <Vector3>();

            for (int t = timestep; t >= 0; t--)
            {
                if (poss.Count >= trailLength)
                {
                    break;
                }
                poss.Add(agents_[i].pos[t]);
            }

            walkerAgents_[i].GetComponent <LineRenderer>().positionCount = poss.Count;
            walkerAgents_[i].GetComponent <LineRenderer>().SetPositions(poss.ToArray());
        }

        if (captureScreenshots)
        {
            ScreenCapture.CaptureScreenshot("Screenshots/shot_" + (timestep + 1) + ".png");
        }

        if (!showInfo)
        {
            info_.text = "";
        }
        else
        {
            info_.text = "Timestep : " + (timestep + 1) + "/" + (maxTimeStep + 1)
                         + "\nTotal Collisions : " + (writeStatistics ? TotalCollisions_.ToString() : "N/A");
        }


        timestep = (timestep + 1) % (maxTimeStep + 1);

        if (timestep == 0)
        {
            animate = false;
            Debug.Log("Done");
        }
    }
Example #7
0
 private void A()
 {
     ScreenCapture.CaptureScreenshot("Assets/Screenshots/Screenshot" + UnityEngine.Random.Range(0, 100000).ToString() + ".png");
 }
    IEnumerator  WaitAndScreen()
    {
        yield return(new WaitForSeconds(1));

        ScreenCapture.CaptureScreenshot(@screenShotFilepath + genNumber.ToString() + ".png");
    }
Example #9
0
    public static void CaptureScreenshot()
    {
        string path = EditorUtility.SaveFilePanel("Screenshot Destination", "", "Screenshot", "png");

        ScreenCapture.CaptureScreenshot(path);
    }
        /// <summary>
        /// Captures a screenshot with the current main camera's clear color.
        /// </summary>
        /// <param name="path">The path to save the screenshot to.</param>
        /// <param name="superSize">The multiplication factor to apply to the native resolution.</param>
        /// <param name="transparentClearColor">True if the captured screenshot should have a transparent clear color. Which can be used for screenshot overlays.</param>
        /// <param name="camera">The optional camera to take the screenshot from.</param>
        /// <returns>True on successful screenshot capture, false otherwise.</returns>
        public static bool CaptureScreenshot(string path, int superSize = 1, bool transparentClearColor = false, Camera camera = null)
        {
            if (string.IsNullOrEmpty(path) || superSize <= 0)
            {
                return(false);
            }

            // If a transparent clear color isn't needed and we are capturing from the default camera, use Unity's screenshot API.
            if (!transparentClearColor && (camera == null || camera == CameraCache.Main))
            {
                ScreenCapture.CaptureScreenshot(path, superSize);

                Debug.LogFormat("Screenshot captured to: {0}", path);

                return(true);
            }

            // Make sure we have a valid camera to render from.
            if (camera == null)
            {
                camera = CameraCache.Main;

                if (camera == null)
                {
                    Debug.Log("Failed to acquire a valid camera to capture a screenshot from.");

                    return(false);
                }
            }

            // Create a camera clone with a transparent clear color.
            var renderCamera = new GameObject().AddComponent <Camera>();

            renderCamera.orthographic       = camera.orthographic;
            renderCamera.transform.position = camera.transform.position;
            renderCamera.transform.rotation = camera.transform.rotation;
            renderCamera.clearFlags         = transparentClearColor ? CameraClearFlags.Color : camera.clearFlags;
            renderCamera.backgroundColor    = transparentClearColor ? new Color(0.0f, 0.0f, 0.0f, 0.0f) : camera.backgroundColor;
            renderCamera.nearClipPlane      = camera.nearClipPlane;
            renderCamera.farClipPlane       = camera.farClipPlane;

            if (renderCamera.orthographic)
            {
                renderCamera.orthographicSize = camera.orthographicSize;
            }
            else
            {
                renderCamera.fieldOfView = camera.fieldOfView;
            }

            // Create a render texture for the camera clone to render into.
            var width         = Screen.width * superSize;
            var height        = Screen.height * superSize;
            var renderTexture = new RenderTexture(width, height, 24, RenderTextureFormat.ARGB32);

            renderTexture.antiAliasing = 8;
            renderCamera.targetTexture = renderTexture;

            // Render from the camera clone.
            renderCamera.Render();

            // Copy the render from the camera and save it to disk.
            var           outputTexture         = new Texture2D(width, height, TextureFormat.ARGB32, false);
            RenderTexture previousRenderTexture = RenderTexture.active;

            RenderTexture.active = renderTexture;
            outputTexture.ReadPixels(new Rect(0.0f, 0.0f, width, height), 0, 0);
            outputTexture.Apply();
            RenderTexture.active = previousRenderTexture;

            try
            {
                File.WriteAllBytes(path, outputTexture.EncodeToPNG());
            }
            catch (Exception e)
            {
                Debug.LogException(e);

                return(false);
            }
            finally
            {
                UnityEngine.Object.DestroyImmediate(outputTexture);
                UnityEngine.Object.DestroyImmediate(renderCamera.gameObject);
                UnityEngine.Object.DestroyImmediate(renderTexture);
            }

            Debug.LogFormat("Screenshot captured to: {0}", path);

            return(true);
        }
 public void OnClick()
 {
     ScreenCapture.CaptureScreenshot(imageName);
     Debug.Log("Foto Genomen");
 }
Example #12
0
 // 현재 화면을 저장한다.
 public static void ScreenshotCapture(string filename, float captureZoomRate)
 {
     m_fOldCameraSize        = Camera.main.fieldOfView;
     Camera.main.fieldOfView = m_fOldCameraSize / captureZoomRate;
     ScreenCapture.CaptureScreenshot(filename);
 }
Example #13
0
 public static void CaptureScreenshot()
 {
     ScreenCapture.CaptureScreenshot("C:/Users/User/Desktop/screenshot.png");
     Debug.Log("********* C:/Users/User/Desktop/screenshot.png was SAVED *********");
 }
Example #14
0
 public void TakeScreenshot()
 {
     ScreenCapture.CaptureScreenshot(filename + "_" + suffix + ".png");
     suffix++;
 }
Example #15
0
 /*
  * private IEnumerator DelayMethod(float waitTime, Action action)
  * {
  *  yield return new WaitForSeconds(waitTime);
  *  action();
  * }
  */
 private void Capture(string filePath)
 {
     ScreenCapture.CaptureScreenshot(filePath);
 }
Example #16
0
 void TakeScreenshot()
 {
     System.DateTime t = System.DateTime.Now;
     ScreenCapture.CaptureScreenshot(Application.dataPath + "/../Screenshot_" + t.Hour.ToString("00") + '-' + t.Minute.ToString("00") + '-' + t.Second.ToString("00") + ".png");
 }
Example #17
0
    public IEnumerator Capture()
    {
        yield return(new WaitForEndOfFrame());

        screenCap.ReadPixels(new Rect(198, 98, 298, 198), 0, 0);
        screenCap.Apply();

        // Encode texture into PNG
        byte[] bytes = screenCap.EncodeToPNG();
        //Object.Destroy(screenCap);

        // For testing purposes, also write to a file in the project folder

        string screenshotFilename = "Green_" + System.DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + ".JPG";

        ScreenCapture.CaptureScreenshot(screenshotFilename);


        if (Application.platform == RuntimePlatform.Android)
        {
            string myFolderLocation = "/sdcard/DCIM/ARDinasours/";


            if (!System.IO.Directory.Exists(myFolderLocation))
            {
                System.IO.Directory.CreateDirectory(myFolderLocation);
            }

            movePath = myFolderLocation + screenshotFilename;
        }


        filePath = screenshotFilename;

        shot = true;

        ssButton.SetActive(true);
        SizeSlider.SetActive(true);
        AddButton.SetActive(true);


        ActiveUrl = movePath;

        // string action = Intent.ACTION_MEDIA_SCANNER_SCAN_FILE
        AndroidJavaClass intentClass = new AndroidJavaClass("android.content.Intent");
        string           action      = intentClass.GetStatic <string>("ACTION_MEDIA_SCANNER_SCAN_FILE");

        // Intent intentObject = new Intent(action);
        AndroidJavaObject intentObject = new AndroidJavaObject("android.content.Intent", action);

        // Uri uriObject = Uri.parse("file:" + filePath);
        AndroidJavaClass  uriClass  = new AndroidJavaClass("android.net.Uri");
        AndroidJavaObject uriObject = uriClass.CallStatic <AndroidJavaObject>("parse", "file://" + movePath);

        // intentObject.setData(uriObject);
        intentObject.Call <AndroidJavaObject>("setData", uriObject);

        // this.sendBroadcast(intentObject);
        AndroidJavaClass  unity           = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject currentActivity = unity.GetStatic <AndroidJavaObject>("currentActivity");

        currentActivity.Call("sendBroadcast", intentObject);
    }
Example #18
0
 public IEnumerator Capture()
 {
     ScreenCapture.CaptureScreenshot("Screenshot" + i + ".png");
     i++;
     yield return(null);
 }
Example #19
0
    IEnumerator Capture()
    {
        yield return(new WaitForSeconds(ShutterWaitTime));

        ScreenCapture.CaptureScreenshot(FolderPath + "/Screen.png");
    }
Example #20
0
File: Game.cs Project: seganx/ameza
    private void Start()
    {
#endif
        Console.OnDisplayInfo += str =>
        {
            return("Ver: " + Application.version + " Group: " + GlobalConfig.Group + "\nId: " + SeganX.Console.DisplayDeviceID);
        };

        Loading.Show();
        Profile.Sync(false, succss =>
        {
            Loading.Hide();
            OpenState <State_Main>();
        });

#if TAPSELL
        TapsellPlusSDK.TapsellPlus.Initialize("eojghhgttbmtjibqhsjtrkprmpiparomofortdgjrndaqtocafonrglqlhgionkrgbbija",
                                              adNetworkName => Debug.Log(adNetworkName + " Initialized Successfully."),
                                              error => Debug.Log(error.ToString()));
#endif
        Fun.Iab.PurchaseSystem.Initialize(GlobalConfig.Instance.version, GlobalConfig.Market.rsaKey, GlobalConfig.Market.storeUrl);

        SeganX.LocalNotification.Initialize(GlobalConfig.Notifications.items);
        SeganX.LocalNotification.OnScheduleNotification += () =>
        {
            // schedule hearts push
            if (Profile.Hearts < GlobalConfig.ProfilePreset.hearts)
            {
                int totalSeconds = GlobalConfig.ProfilePreset.hearts * GlobalConfig.Heart.interval;
                SeganX.LocalNotification.SendNotification(totalSeconds, GlobalConfig.Notifications.heartFull);
            }

            // schedule lucky spin push
            var seconds = SeganX.Online.Timer.GetRemainSeconds(GlobalConfig.Luckyspin.timerId, GlobalConfig.Luckyspin.interval);
            if (seconds > 10)
            {
                SeganX.LocalNotification.SendNotification(seconds, GlobalConfig.Notifications.luckySpine);
            }
        };

        CheckABTest();
        GlobalAnalytics.ABTest.OnRecieved = CheckABTest;

#if UNITY_EDITOR
        while (true)
        {
            yield return(new WaitForEndOfFrame());

            if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.Space))
            {
                var path = Application.dataPath + "/../../Documents/Screenshots/" + System.DateTime.Now.Ticks + ".png";
                path = System.IO.Path.GetFullPath(path);
                ScreenCapture.CaptureScreenshot(path);
                yield return(new WaitForSeconds(0.5f));

                Application.OpenURL(path);
                UnityEditor.EditorUtility.RevealInFinder(path);
            }
        }
#endif
    }
Example #21
0
 void TakeShot()
 {
     Debug.Log("Getting Vision Data...");
     ScreenCapture.CaptureScreenshot("shot.png");
     StartCoroutine(GetVisionDataFromImages());
 }
Example #22
0
 private static void Screenshot()
 {
     ScreenCapture.CaptureScreenshot(Application.productName + "-" + DateTime.Now.ToString("hhmmss") + ".png");
     Debug.Log("CLICK: " + Application.productName + "-" + DateTime.Now.ToString("hhmmss") + ".png");
 }
Example #23
0
    public void ScreenShot()
    {
        string path1 = "Assets/Resources/Images/SS" + iteracion.ToString() + ".png";

        ScreenCapture.CaptureScreenshot(path1);
    }
Example #24
0
 void CaptureScreenshot()
 {
     ScreenCapture.CaptureScreenshot(m_filePath);
 }
        /// <summary>
        /// 加载所有assetbundle
        /// </summary>
        /// <returns></returns>
        static IEnumerator IE_LoadAll()
        {
            var outpath = BApplication.BDEditorCachePath + "/AssetBundle";

            if (!Directory.Exists(outpath))
            {
                Directory.CreateDirectory(outpath);
            }

            loadDataMap.Clear();
            //加载
            var allRuntimeAssets = BApplication.GetAllRuntimeAssetsPath();

            foreach (var asset in allRuntimeAssets)
            {
                var type = AssetBundleEditorToolsV2.GetMainAssetTypeAtPath(asset);
                if (type == null)
                {
                    Debug.LogError("无法获得资源类型:" + asset);
                    continue;
                }

                var idx         = asset.IndexOf(AssetBundleBuildingContext.RUNTIME_PATH, StringComparison.OrdinalIgnoreCase);
                var runtimePath = asset.Substring(idx + AssetBundleBuildingContext.RUNTIME_PATH.Length);
                runtimePath = runtimePath.Replace(Path.GetExtension(runtimePath), "");
                runtimePath = runtimePath.Replace("\\", "/");
                //Debug.Log("【LoadTest】:" + runtimePath);
                List <LoadTimeData> loadList = null;
                if (!loadDataMap.TryGetValue(type.FullName, out loadList))
                {
                    loadList = new List <LoadTimeData>();
                    loadDataMap[type.FullName] = loadList;
                }

                var loadData = new LoadTimeData();
                loadData.LoadPath = runtimePath;
                loadList.Add(loadData);
                //计时器
                Stopwatch sw = new Stopwatch();
                if (type == typeof(GameObject))
                {
                    //加载
                    sw.Start();
                    var obj = AssetBundleLoader.Load <GameObject>(runtimePath);
                    sw.Stop();
                    loadData.LoadTime = sw.ElapsedTicks;
                    //实例化
                    if (obj != null)
                    {
                        sw.Restart();
                        var gobj = GameObject.Instantiate(obj);
                        sw.Stop();
                        loadData.InstanceTime = sw.ElapsedTicks;
                        //UI
                        var rectTransform = gobj.GetComponentInChildren <RectTransform>();
                        if (rectTransform != null)
                        {
                            gobj.transform.SetParent(UI_ROOT, false);
                        }
                        else
                        {
                            gobj.transform.SetParent(SCENE_ROOT);
                        }

                        //抓屏 保存
                        var outpng = string.Format("{0}/{1}_ab.png", outpath, runtimePath.Replace("/", "_"));
                        yield return(null);

                        //渲染
                        GameView.Repaint();
                        GameView.Focus();

                        yield return(null);

                        //抓屏
                        //TODO 这里有时候能抓到 有时候抓不到
                        ScreenCapture.CaptureScreenshot(outpng);
                        //删除
                        GameObject.DestroyImmediate(gobj);
                    }
                    else
                    {
                        UnityEngine.Debug.LogError("【Prefab】加载失败:" + runtimePath);
                    }
                }
                else if (type == typeof(TextAsset))
                {
                    //测试打印AssetText资源
                    sw.Start();
                    var textAsset = AssetBundleLoader.Load <TextAsset>(runtimePath);
                    sw.Stop();
                    loadData.LoadTime = sw.ElapsedTicks;
                    if (!textAsset)
                    {
                        UnityEngine.Debug.LogError("【TextAsset】加载失败:" + runtimePath);
                    }
                    else
                    {
                        UnityEngine.Debug.Log(textAsset.text);
                    }
                }
                else if (type == typeof(Texture))
                {
                    sw.Start();
                    var tex = AssetBundleLoader.Load <Texture>(runtimePath);
                    sw.Stop();
                    loadData.LoadTime = sw.ElapsedTicks;
                    if (!tex)
                    {
                        UnityEngine.Debug.LogError("【Texture】加载失败:" + runtimePath);
                    }

                    break;
                }
                else if (type == typeof(Texture2D))
                {
                    sw.Start();
                    var tex = AssetBundleLoader.Load <Texture2D>(runtimePath);
                    sw.Stop();
                    loadData.LoadTime = sw.ElapsedTicks;
                    if (!tex)
                    {
                        UnityEngine.Debug.LogError("【Texture2D】加载失败:" + runtimePath);
                    }
                }
                else if (type == typeof(Sprite))
                {
                    sw.Start();
                    var sp = AssetBundleLoader.Load <Sprite>(runtimePath);
                    sw.Stop();
                    loadData.LoadTime = sw.ElapsedTicks;
                    if (!sp)
                    {
                        UnityEngine.Debug.LogError("【Sprite】加载失败:" + runtimePath);
                    }
                }
                else if (type == typeof(Material))
                {
                    sw.Start();
                    var mat = AssetBundleLoader.Load <Material>(runtimePath);
                    sw.Stop();
                    loadData.LoadTime = sw.ElapsedTicks;
                    if (!mat)
                    {
                        UnityEngine.Debug.LogError("【Material】加载失败:" + runtimePath);
                    }
                }
                else if (type == typeof(Shader))
                {
                    sw.Start();
                    var shader = AssetBundleLoader.Load <Shader>(runtimePath);
                    sw.Stop();
                    loadData.LoadTime = sw.ElapsedTicks;
                    if (!shader)
                    {
                        UnityEngine.Debug.LogError("【Shader】加载失败:" + runtimePath);
                    }
                }
                else if (type == typeof(AudioClip))
                {
                    sw.Start();
                    var ac = AssetBundleLoader.Load <AudioClip>(runtimePath);
                    sw.Stop();
                    loadData.LoadTime = sw.ElapsedTicks;
                    if (!ac)
                    {
                        UnityEngine.Debug.LogError("【AudioClip】加载失败:" + runtimePath);
                    }
                }
                else if (type == typeof(AnimationClip))
                {
                    sw.Start();
                    var anic = AssetBundleLoader.Load <AnimationClip>(runtimePath);
                    sw.Stop();
                    loadData.LoadTime = sw.ElapsedTicks;
                    if (!anic)
                    {
                        UnityEngine.Debug.LogError("【AnimationClip】加载失败:" + runtimePath);
                    }
                }
                else if (type == typeof(Mesh))
                {
                    sw.Start();
                    var mesh = AssetBundleLoader.Load <Mesh>(runtimePath);
                    sw.Stop();
                    loadData.LoadTime = sw.ElapsedTicks;
                    if (!mesh)
                    {
                        UnityEngine.Debug.LogError("【Mesh】加载失败:" + runtimePath);
                    }
                }
                else if (type == typeof(Font))
                {
                    sw.Start();

                    var font = AssetBundleLoader.Load <Font>(runtimePath);

                    sw.Stop();
                    loadData.LoadTime = sw.ElapsedTicks;
                    if (!font)
                    {
                        UnityEngine.Debug.LogError("【Font】加载失败:" + runtimePath);
                    }
                }
                else if (type == typeof(SpriteAtlas))
                {
                    sw.Start();
                    var sa = AssetBundleLoader.Load <SpriteAtlas>(runtimePath);
                    sw.Stop();
                    if (!sa)
                    {
                        UnityEngine.Debug.LogError("【SpriteAtlas】加载失败:" + runtimePath);
                    }

                    loadData.LoadTime = sw.ElapsedTicks;
                }
                else if (type == typeof(ShaderVariantCollection))
                {
                    sw.Start();
                    var svc = AssetBundleLoader.Load <ShaderVariantCollection>(runtimePath);
                    svc?.WarmUp();
                    sw.Stop();
                    if (!svc)
                    {
                        UnityEngine.Debug.LogError("【ShaderVariantCollection】加载失败:" + runtimePath);
                    }

                    loadData.LoadTime = sw.ElapsedTicks;
                }
                else if (type == typeof(AnimatorController))
                {
                    sw.Start();
                    var aniCtrl = AssetBundleLoader.Load <AnimatorController>(runtimePath);
                    sw.Stop();
                    if (!aniCtrl)
                    {
                        UnityEngine.Debug.LogError("【AnimatorController】加载失败:" + runtimePath);
                    }

                    loadData.LoadTime = sw.ElapsedTicks;
                }
                else
                {
                    sw.Start();
                    var gobj = AssetBundleLoader.Load <Object>(runtimePath);
                    sw.Stop();
                    if (!gobj)
                    {
                        UnityEngine.Debug.LogError("【Object】加载失败:" + runtimePath);
                    }

                    UnityEngine.Debug.LogError("待编写测试! -" + type.FullName);
                }

                //打印

                Debug.LogFormat("<color=yellow>{0}</color> <color=green>【加载】:<color=yellow>{1}ms</color>;【初始化】:<color=yellow>{2}ms</color> </color>", loadData.LoadPath, loadData.LoadTime / 10000f, loadData.InstanceTime / 10000f);
                yield return(null);
            }

            yield return(null);

            foreach (var item in loadDataMap)
            {
                Debug.Log("<color=red>【" + item.Key + "】</color>");
                foreach (var ld in item.Value)
                {
                    Debug.LogFormat(
                        "<color=yellow>{0}</color> <color=green>【加载】:<color=yellow>{1}ms</color>;【初始化】:<color=yellow>{2}ms</color> </color>",
                        ld.LoadPath, ld.LoadTime / 10000f, ld.InstanceTime / 10000f);
                }
            }

            yield return(null);

            EditorUtility.RevealInFinder(outpath);
        }
Example #26
0
 /// <summary>
 /// 截取整个Game界面
 /// </summary>
 /// <param name="fileName">保存路径+名称+后缀名</param>
 /// <param name="definition">像素放大倍数</param>
 public static void Capture_Game(string fileName, int definition = 1)
 {
     //全屏截图,图片保存路径,提高分辨率系数
     ScreenCapture.CaptureScreenshot(fileName, definition);
     count += 1;
 }
Example #27
0
    public IEnumerator CaptureScreen()   // iterate through the screens and take captures.
    {
        GameObject parent = GameObject.FindGameObjectWithTag("SupervisorSignoff");
        //if (this.transform.parent.gameObject.CompareTag("SupervisorSignoff"))
        //{
        GameObject pdfButton = parent.transform.GetChild(3).gameObject;

        pdfButton.SetActive(false);
        // Debug.Log("PDF Button turned off " + pdfButton.name);
        //}
        if (!Directory.Exists(screenCapDir))
        {
            Directory.CreateDirectory(screenCapDir);
        }
        foreach (string file in Directory.GetFiles(screenCapDir, "*.png").Where(item => item.EndsWith(".png")))
        {
            File.Delete(file);
        }

        // loop here to go through each page panel and take a screnshot;
        string capName;

        foreach (GameObject page in pageList)
        {
            page.gameObject.SetActive(false);
        }

        int pageCountModifier = pageList.Count; // the amount of pages to capture based on criteria below.
        int startPageNum      = 0;              // the page number to start capturing at;

        if (pageController.isEmergency)
        {
            pageCountModifier = pageList.Count - (pageList.Count - 1);
            // Debug.Log("is emergency pagecount modifier" + pageCountModifier);
            startPageNum = 0;
        }
        if (pageController.isCSEP && !pageController.isCSEP2)
        {
            pageCountModifier = 7;
            startPageNum      = 1;
        }
        if (pageController.isCSEP2)
        {
            pageCountModifier = pageList.Count;
            startPageNum      = 1;
        }
        if (!pageController.isCSEP && !pageController.isEmergency)
        {
            pageCountModifier = 6;
            startPageNum      = 1;
        }

        //if (pageController.isEmergency)
        //{
        //    for (int i = 0; i < 1; i++)
        //    {
        //       // Debug.Log("Using Emergency Cap");
        //        pageList[i].gameObject.SetActive(true);
        //        capName = "screenshot" + captureNum + ".png".ToString();
        //        Application.CaptureScreenshot(screenCapDir + "/" + capName);
        //        yield return new WaitForSeconds(.01f);
        //       // Debug.Log("Screnshot captured" + captureNum);
        //        pageList[i].gameObject.SetActive(false);
        //        captureNum++;

        //    }
        //}

        //if (!pageController.isEmergency) {
        //   // Debug.Log("PagelistCount " + pageList.Count);
        for (int i = startPageNum; i < pageCountModifier; i++)
        {
            // Debug.Log("Not Emergency Caps");
            pageList[i].gameObject.SetActive(true);
            capName = "screenshot" + captureNum + ".png".ToString();
            ScreenCapture.CaptureScreenshot(screenCapDir + "/" + capName);
            // TODO place while loop to test if file is created yet instead of waitforseconds.
            yield return(new WaitForSeconds(.01f));

            FileInfo fileToTest = new FileInfo(screenCapDir + "/" + capName);

            Debug.Log("Screnshot captured" + captureNum);
            pageList[i].gameObject.SetActive(false);
            captureNum++;
            yield return(new WaitUntil(() => IsFileLocked(fileToTest) == false));
        }
        //}
        PdfCreationPanel.SetActive(true);
        PDFCreationText.text = "Preparing to create PDF file :" + SaveFile.loadName;
        //yield return new WaitForSeconds(3f);

        // pageController.FinishPage(); // set screen to finished page.
        captureNum = 0;



        // loop through all screenshots before creating pdf.

        PopulateArray(screenCapDir); // gather all trhe screenshots to array
        // yield return new WaitForSeconds(0.5f);
        if (!Directory.Exists(pdfSaveDir))
        {
            Directory.CreateDirectory(pdfSaveDir);
        }
        // StartCoroutine(CreatePDF(pdfSaveDir));  // create the pdf
    }
Example #28
0
 void OnMouseDown()
 {
     ScreenCapture.CaptureScreenshot("Rose Bouquet");
 }
 public override void Execute(GameObject instigator = null)
 {
     ScreenCapture.CaptureScreenshot(fileName + screenshotNumber.ToString().PadLeft(figureCount, '0') + ".png", supersampleRate);
     screenshotNumber += 1;
 }
Example #30
0
    private IEnumerator RotateAndCapture() // for loop based on elevation angle + azim angle + dist value
    {
        for (int x = minDist; x <= maxDist; x += increment1)
        {
            transform.Translate(0, 0, transform.position.z - x);

            Debug.Log("POSITION: " + transform.position);
            for (int v = minAzimAngle; v <= maxAzimAngle; v += increment3)
            {
                transform.RotateAround(target, Vector3.up, increment3);


                for (int c = minElevAngle; c <= maxElevAngle; c += increment2)
                {
                    Vector3 temp = transform.rotation.eulerAngles;
                    temp.x             = c;
                    transform.rotation = Quaternion.Euler(temp);



                    for (int w = minObjRot; w <= maxObjRot; w += increment4)
                    {
                        foreach (Transform t in models)
                        {
                            Vector3 temp2 = t.rotation.eulerAngles;
                            temp2.y    = w;
                            t.rotation = Quaternion.Euler(temp2);
                        }

                        string imageName = "Light" + GameManager.SliderValue + "_D" + x + "_Azim" + v + "_Elev" + c + "_ObjRot" + w + "_Scene" + sceneInd + "_" + index + ".png";


                        T1.LookAt(target);
                        ScreenCapture.CaptureScreenshot(Path.Combine(path + imageName));

                        yield return(new WaitForSeconds(.05f));

                        Camera1.enabled = false;
                        Camera2.enabled = true;
                        T2.LookAt(target);

                        ScreenCapture.CaptureScreenshot(Path.Combine(path2 + imageName));

                        yield return(new WaitForSeconds(.05f));

                        Camera2.enabled = false;
                        Camera3.enabled = true;
                        T3.LookAt(target);

                        ScreenCapture.CaptureScreenshot(Path.Combine(path3 + imageName));
                        yield return(new WaitForSeconds(.05f));

                        Camera3.enabled = false;
                        Camera1.enabled = true;
                        index++;
                    }
                }
            }
        }


        panel2.SetActive(true);
        Debug.Log("YOURE DONE");
    }