示例#1
0
        public void OnLevelWasLoaded(int level)
        {
            CoreLogger.LogInfo(LoggerModules.SceneManager, "Received Level Loaded event - stopping fade out if still running");

            //never activated
            if (_stage == Stage.Inactive)
            {
                return;
            }

            //stage can be either Limbo, signaling we are done, or Out,
            //signaling we had a timeout (the scene manager didn't want
            //to wait for us)
            _stage = Stage.In;

            //verify we are not fading out anymore
            if (!_outDone)
            {
                StopCoroutine("TransitionOut");
                _outDone = true;
            }

            //start fading in
            StartCoroutine("TransitionIn");
        }
示例#2
0
    }    //Constructor

    /* PUBLIC METHODS */
    public bool importAll()
    {
        var ext = new List <string> {
            ".jpg", ".stack", ".jpeg"
        };
        var fnamesRaw = Directory.GetFiles(this.fileUtils.importFolder, "*.*", SearchOption.TopDirectoryOnly).Where(s => ext.Contains(Path.GetExtension(s)));

        string[] fnames = new string[fnamesRaw.Count()];
        for (int i = 0; i < fnamesRaw.Count(); i++)
        {
            fnames[i] = Path.GetFileName(fnamesRaw.ElementAt(i));
        }
        ;

        //String[] fnames = new DirectoryInfo(this.fileUtils.importFolder).GetFiles().Select(o => o.Name).ToArray();//Get a list of all in the folder except the directory "imported"

        if (fnames.Length == 0)    //   Console.Out.WriteLine("There were no CloudCoins to import. Please place our CloudCoin .jpg and .stack files in your imports" + " folder at " + this.fileUtils.importFolder );
        {
            return(false);
        }
        else
        {
            //  Console.ForegroundColor = ConsoleColor.Green;
            //  Console.Out.WriteLine("Importing the following files: ");
            CoreLogger.Log("Importing the following files: ");
            //  Console.ForegroundColor = ConsoleColor.White;
            for (int i = 0; i < fnames.Length; i++)    // Loop through each file.
            {
                Console.Out.WriteLine(fnames[i]);
                CoreLogger.Log(fnames[i]);
                this.importOneFile(fnames[i]);
            } // end for each file name
            return(true);
        }     //end if no files
    }         // End Import All
示例#3
0
    }    //import stack

    public bool seemsValidJSON(string json)
    {
        /*This does some simple tests to see if the JSON is valid. It is not precise.*/


        if (json.Count(f => f == '{') != json.Count(f => f == '}'))
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Out.WriteLine("The stack file did not have a matching number of { }. There were " + json.Count(f => f == '{') + " {, and " + json.Count(f => f == '}') + " }");
            CoreLogger.Log("The stack file did not have a matching number of { }. There were " + json.Count(f => f == '{') + " {, and " + json.Count(f => f == '}') + " }");
            Console.ForegroundColor = ConsoleColor.White;
            return(false);
        }    //Check if number of currly brackets open are the same as closed
        if (json.Count(f => f == '[') != json.Count(f => f == ']'))
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Out.WriteLine("The stack file did not have a matching number of []. There were " + json.Count(f => f == '[') + " [, and " + json.Count(f => f == ']') + " ]");
            CoreLogger.Log("The stack file did not have a matching number of []. There were " + json.Count(f => f == '[') + " [, and " + json.Count(f => f == ']') + " ]");
            Console.ForegroundColor = ConsoleColor.White;
            return(false);
        }    //Check if number of  brackets open are the same as closed
        if (IsOdd(json.Count(f => f == '\"')))
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Out.WriteLine("The stack file did not have a matching number of double quotations");
            CoreLogger.Log("The stack file did not have a matching number of double quotations");
            Console.ForegroundColor = ConsoleColor.White;
            return(false);
        } //Check if number of
        return(true);
    }     //end seems valid
示例#4
0
        IEnumerator TransitionIn()
        {
            CoreLogger.LogInfo(LoggerModules.SceneManager, "staring transition in...");
            StartTransitionIn(this);
            OnStartTransitionIn();
            CoreLogger.LogInfo(LoggerModules.SceneManager, "transition in started");

            _transitionStartTime = Time.time;
            float elapsed = 0f;

            while (elapsed < transitionInMinimalDuration)
            {
                HandleIn(elapsed);
                yield return(null);

                _now    = Time.time;
                elapsed = Time.time - _transitionStartTime;
            }

            _stage = Stage.Done;

            CoreLogger.LogInfo(LoggerModules.SceneManager, "ending transition in...");
            EndTransitionIn(this);
            OnEndTransitionIn();
            CoreLogger.LogInfo(LoggerModules.SceneManager, "transition in ended");

            _inDone = true;
            yield return(null);

            DestroyObject(gameObject);
        }
示例#5
0
        /// <summary>
        /// 更新指定的对象(一般情况下,由于对象发生了位置变化造成AABB变化后需要更新)
        /// </summary>
        /// <param name="quadObject"></param>
        public void UpdateObject(IQuadObject quadObject)
        {
            if (m_ObjectToNodeDic.TryGetValue(quadObject, out var node))
            {
                RemoveObjectFromNode(node, quadObject);

                QuadNode targetNode = node;
                while (targetNode != null)
                {
                    if (targetNode.Bounds.Contains(quadObject.Bounds))
                    {
                        break;
                    }
                    targetNode = targetNode.ParentNode;
                }
                if (targetNode != null)
                {
                    targetNode = InsertObjectToNode(targetNode, quadObject);

                    if (targetNode != node)
                    {
                        MergeNode(node);
                    }
                }
                else
                {
                    CoreLogger.Error(QuadTree.LOG_TAG, "the object hasn't been added to tree");
                }
            }
            else
            {
                CoreLogger.Error(QuadTree.LOG_TAG, "the object hasn't been added to tree");
            }
        }
        IEnumerator _SwitchScene(string newScene, IEnumerable <IEnumerableAction> preloadActions)
        {
            SceneRequested(newScene);

            if (asyncLoading)
            {
                yield return(PreloadActions(preloadActions));

                CoreLogger.LogNotice("UnitySceneManager", string.Format("switching to scene {0}", newScene));

                SceneLoadStarted(newScene);

                yield return(Application.LoadLevelAsync(newScene));
            }
            else
            {
                HandlePreloadActions(preloadActions);

                CoreLogger.LogNotice("UnitySceneManager", string.Format("switching to scene {0}", newScene));
                Application.LoadLevel(newScene);

                SceneLoadStarted(newScene);

                yield break;
            }
        }
示例#7
0
        private QuadNode InsertObjectToNode(QuadNode node, IQuadObject quadObject)
        {
            if (!node.Bounds.Contains(quadObject.Bounds))
            {
                CoreLogger.Error(LOG_TAG, "QuadTree::InsertObjectToNode->Object's bounds is not fit within node bounds");
                return(null);
            }

            if (node.IsLeaf && node.Depth < m_MaxDepth && node.ObjectCount >= m_NodeSplitThreshold)
            {
                SplitNode(node);
                ResetNodeObjects(node);
            }

            if (!node.IsLeaf)
            {
                QuadNode[] childNodes = node.ChildNodes;
                foreach (var childNode in childNodes)
                {
                    if (childNode.Bounds.Contains(quadObject.Bounds))
                    {
                        return(InsertObjectToNode(childNode, quadObject));
                    }
                }
            }

            node.InsertObject(quadObject);
            m_ObjectToNodeDic[quadObject] = node;

            return(node);
        }
示例#8
0
    }      // End constructor

    /* PUBLIC METHODS */

    // This loads a JSON file (.stack) from the hard drive that contains only one CloudCoin and turns it into an object.
    //   This uses Newton soft but causes a enrror System.IO.FileNotFoundException. Could not load file 'Newtonsoft.Json'
    public FoundersCloudCoin loadOneCloudCoinFromJsonFile(String loadFilePath)
    {
        FoundersCloudCoin returnCC = new FoundersCloudCoin();

        //Load file as JSON
        String incomeJson = this.importJSON(loadFilePath);
        //STRIP UNESSARY test
        int secondCurlyBracket     = ordinalIndexOf(incomeJson, "{", 2) - 1;
        int firstCloseCurlyBracket = ordinalIndexOf(incomeJson, "}", 0) - secondCurlyBracket;

        // incomeJson = incomeJson.Substring(secondCurlyBracket, firstCloseCurlyBracket);
        incomeJson = incomeJson.Substring(secondCurlyBracket, firstCloseCurlyBracket + 1);
        // Console.Out.WriteLine(incomeJson);
        //Deserial JSON

        try
        {
            returnCC = JsonConvert.DeserializeObject <FoundersCloudCoin>(incomeJson);
        }
        catch (JsonReaderException)
        {
            Console.WriteLine("There was an error reading files in your bank.");
            CoreLogger.Log("There was an error reading files in your bank.");
            Console.WriteLine("You may have the aoid memo bug that uses too many double quote marks.");
            Console.WriteLine("Your bank files are stored using and older version that did not use properly formed JSON.");
            Console.WriteLine("Would you like to upgrade these files to the newer standard?");
            Console.WriteLine("Your files will be edited.");
            Console.WriteLine("1 for yes, 2 for no.");
            KeyboardReader reader = new KeyboardReader();
            int            answer = reader.readInt(1, 2);
            if (answer == 1)
            {
                //Get rid of ed and aoid
                //Get file names in bank folder
                String[] fileNames = new DirectoryInfo(bankFolder).GetFiles().Select(o => o.Name).ToArray();
                for (int i = 0; i < fileNames.Length; i++)
                {
                    Console.WriteLine("Fixing " + bankFolder + "\\" + fileNames[i]);
                    CoreLogger.Log("Fixing " + bankFolder + "\\" + fileNames[i]);
                    string text = File.ReadAllText(bankFolder + "\\" + fileNames[i]);
                    text = text.Replace("\"aoid\": [\"memo\"=\"\"]", "");
                    File.WriteAllText(bankFolder + "\\" + fileNames[i], text);
                }    //End for all files in bank
                CoreLogger.Log("Done Fixing. The program will now exit. Please restart. Press any key.");
                Console.WriteLine("Done Fixing. The program will now exit. Please restart. Press any key.");
                Console.Read();
                Environment.Exit(0);
            }
            else
            {
                CoreLogger.Log("Leaving files as is. You maybe able to fix the manually by editing the files.");
                Console.WriteLine("Leaving files as is. You maybe able to fix the manually by editing the files.");
                Console.WriteLine("Done Fixing. The program will now exit. Please restart. Press any key.");
                Console.Read();
                Environment.Exit(0);
            }
        }

        return(returnCC);
    }    //end load one CloudCoin from JSON
示例#9
0
    }    //end load one CloudCoin from JSON

    public String importJSON(String jsonfile)
    {
        String jsonData = "";
        String line;

        try
        {
            // Create an instance of StreamReader to read from a file.
            // The using statement also closes the StreamReader.

            using (var sr = File.OpenText(jsonfile))
            {
                // Read and display lines from the file until the end of
                // the file is reached.
                while (true)
                {
                    line = sr.ReadLine();
                    if (line == null)
                    {
                        break;
                    } //End if line is null
                    jsonData = (jsonData + line + "\n");
                }     //end while true
            }         //end using
        }
        catch (Exception e)
        {
            // Let the user know what went wrong.
            Console.WriteLine("The file " + jsonfile + " could not be read:");
            CoreLogger.Log("The file " + jsonfile + " could not be read:");
            Console.WriteLine(e.Message);
            CoreLogger.Log(e.Message);
        }
        return(jsonData);
    }    //end importJSON
示例#10
0
    }    //end load one CloudCoin from JSON

    public CloudCoin loadOneCloudCoinFromJPEGFile(String loadFilePath)
    {
        /* GET the first 455 bytes of he jpeg where the coin is located */
        String wholeString = "";

        byte[] jpegHeader = new byte[455];
        Console.Out.WriteLine("Load file path " + loadFilePath);
        CoreLogger.Log("Load file path " + loadFilePath);
        using (FileStream fileStream = new FileStream(loadFilePath, FileMode.Open, FileAccess.Read))
        {
            try
            {
                int count;                                // actual number of bytes read
                int sum = 0;                              // total number of bytes read

                // read until Read method returns 0 (end of the stream has been reached)
                while ((count = fileStream.Read(jpegHeader, sum, 455 - sum)) > 0)
                {
                    sum += count;      // sum is a buffer offset for next reading
                }
            }
            finally { }
        }
        wholeString = bytesToHexString(jpegHeader);
        CloudCoin returnCC = this.parseJpeg(wholeString);

        // Console.Out.WriteLine("From FileUtils returnCC.fileName " + returnCC.fileName);
        return(returnCC);
    }    //end load one CloudCoin from JSON
示例#11
0
        public ITask GetAdditiveLoader(string sceneName, SceneTransition sceneTransition = null, IEnumerable <GameObject> removals = null)
        {
            if (sceneTransition == null)
            {
                sceneTransition = defaultSceneTransition;
            }

//FIXME: Implement Additive for non unity pro
#if UNITY_PRO_LICENSED
            ITask task = new AdditiveSceneLoaderTask(this, sceneName, additiveLoaderWatermark, sceneTransition, removals, additiveLoaderDelay);

            task.Done += result => {
                if (result.IsOk())
                {
                    Logger.LogDebug(LoggerModules.SceneManager, string.Format("loaded scene {0}", sceneName));
                    SceneLoaded(sceneName);
                }
            };

            return(task);
#else
            CoreLogger.LogWarning("Warning - attempting to additively load a scene without Unity Pro License - currently unsupported action");
            return(new SceneLoaderTask(this, sceneName, sceneTransition, null));
#endif
        }
示例#12
0
        public static void ExportPackages()
        {
            CoreLogger.LogDebug("PackageManager", "parsing command line");

            CommandLineParser cmdParser = new CommandLineParser();

            string filename = cmdParser["filename"];

            if (filename != null)
            {
                CoreLogger.LogDebug("PackageManager", string.Format("export manifest specified to be {0}", filename));
            }
            else
            {
                CoreLogger.LogDebug("PackageManager", "export manifest specified to be the default exports.xml");
                filename = "exports.xml";
            }

            string outputPath = cmdParser["outputpath"];

            if (outputPath != null)
            {
                CoreLogger.LogDebug("PackageManager", string.Format("output path set to be {0}", outputPath));
            }
            else
            {
                CoreLogger.LogDebug("PackageManager", "output path set to be the default");
            }

            ExportPackages(filename, outputPath);
        }
示例#13
0
    }    // end parse Jpeg

    public void moveFile(string fromPath, string tooPath)
    {
        string path  = fromPath;
        string path2 = tooPath;

        try
        {
            if (!File.Exists(path))
            {
                // This statement ensures that the file is created,
                // but the handle is not kept.
                using (FileStream fs = File.Create(path)) { }
            }

            // Ensure that the target does not exist.
            if (File.Exists(path2))
            {
                File.Delete(path2);
            }

            // Move the file.
            File.Move(path, path2);
            //Console.WriteLine("{0} was moved to {1}.", path, path2);
        }
        catch (Exception e)
        {
            Console.WriteLine("The process failed: {0}", e.ToString());
            CoreLogger.Log(e.ToString());
        }
    }
示例#14
0
    }               //end detect coin

    public async Task <CoinUtils> detectCoin(CoinUtils cu, int milliSecondsToTimeOut)
    {
        cu.generatePan();

        var t00 = detectOne(00, cu.cc.nn, cu.cc.sn, cu.cc.an[00], cu.pans[00], cu.getDenomination());
        var t01 = detectOne(01, cu.cc.nn, cu.cc.sn, cu.cc.an[01], cu.pans[01], cu.getDenomination());
        var t02 = detectOne(02, cu.cc.nn, cu.cc.sn, cu.cc.an[02], cu.pans[02], cu.getDenomination());
        var t03 = detectOne(03, cu.cc.nn, cu.cc.sn, cu.cc.an[03], cu.pans[03], cu.getDenomination());
        var t04 = detectOne(04, cu.cc.nn, cu.cc.sn, cu.cc.an[04], cu.pans[04], cu.getDenomination());
        var t05 = detectOne(05, cu.cc.nn, cu.cc.sn, cu.cc.an[05], cu.pans[05], cu.getDenomination());
        var t06 = detectOne(06, cu.cc.nn, cu.cc.sn, cu.cc.an[06], cu.pans[06], cu.getDenomination());
        var t07 = detectOne(07, cu.cc.nn, cu.cc.sn, cu.cc.an[07], cu.pans[07], cu.getDenomination());
        var t08 = detectOne(08, cu.cc.nn, cu.cc.sn, cu.cc.an[08], cu.pans[08], cu.getDenomination());
        var t09 = detectOne(09, cu.cc.nn, cu.cc.sn, cu.cc.an[09], cu.pans[09], cu.getDenomination());
        var t10 = detectOne(10, cu.cc.nn, cu.cc.sn, cu.cc.an[10], cu.pans[10], cu.getDenomination());
        var t11 = detectOne(11, cu.cc.nn, cu.cc.sn, cu.cc.an[11], cu.pans[11], cu.getDenomination());
        var t12 = detectOne(12, cu.cc.nn, cu.cc.sn, cu.cc.an[12], cu.pans[12], cu.getDenomination());
        var t13 = detectOne(13, cu.cc.nn, cu.cc.sn, cu.cc.an[13], cu.pans[13], cu.getDenomination());
        var t14 = detectOne(14, cu.cc.nn, cu.cc.sn, cu.cc.an[14], cu.pans[14], cu.getDenomination());
        var t15 = detectOne(15, cu.cc.nn, cu.cc.sn, cu.cc.an[15], cu.pans[15], cu.getDenomination());
        var t16 = detectOne(16, cu.cc.nn, cu.cc.sn, cu.cc.an[16], cu.pans[16], cu.getDenomination());
        var t17 = detectOne(17, cu.cc.nn, cu.cc.sn, cu.cc.an[17], cu.pans[17], cu.getDenomination());
        var t18 = detectOne(18, cu.cc.nn, cu.cc.sn, cu.cc.an[18], cu.pans[18], cu.getDenomination());
        var t19 = detectOne(19, cu.cc.nn, cu.cc.sn, cu.cc.an[19], cu.pans[19], cu.getDenomination());
        var t20 = detectOne(20, cu.cc.nn, cu.cc.sn, cu.cc.an[20], cu.pans[20], cu.getDenomination());
        var t21 = detectOne(21, cu.cc.nn, cu.cc.sn, cu.cc.an[21], cu.pans[21], cu.getDenomination());
        var t22 = detectOne(22, cu.cc.nn, cu.cc.sn, cu.cc.an[22], cu.pans[22], cu.getDenomination());
        var t23 = detectOne(23, cu.cc.nn, cu.cc.sn, cu.cc.an[23], cu.pans[23], cu.getDenomination());
        var t24 = detectOne(24, cu.cc.nn, cu.cc.sn, cu.cc.an[24], cu.pans[24], cu.getDenomination());


        var taskList = new List <Task> {
            t00, t01, t02, t03, t04, t05, t06, t07, t08, t09, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20, t21, t22, t23, t24
        };
        await Task.WhenAll(taskList.ToArray());

        //Get data from the detection agents

        for (int i = 0; i < 25; i++)
        {
            if (responseArray[i] != null)
            {
                cu.setPastStatus(responseArray[i].outcome, i);
                CoreLogger.Log(cu.cc.sn + " detect:" + i + " " + responseArray[i].fullResponse);
            }
            else
            {
                cu.setPastStatus("undetected", i);
            }; // should be pass, fail, error or undetected.
        }      //end for each detection agent

        cu.setAnsToPansIfPassed();
        cu.calculateHP();
        // cu.gradeCoin(); // sets the grade and figures out what the file extension should be (bank, fracked, counterfeit, lost
        cu.calcExpirationDate();
        cu.grade();

        return(cu);
    }    //end detect coin
示例#15
0
            IEnumerator LoadAsset(AssetManager assetManager, string path)
            {
                if (!assetManager.CatalogReady)
                {
                    yield return(_coroutineFactory.StartCoroutine(() => assetManager.CatalogWaiter()));
                }

                string bundleName = assetManager.GetBundleName(path);

                if (bundleName != "")
                {
                    yield return(_coroutineFactory.StartCoroutine(() => WaitForBundle(assetManager, bundleName)));
                }
                else
                {
                    CoreLogger.LogWarning(assetManager.LoggerModule, string.Format("unable to find asset bundle for asset {0}", path));
                }

                if (_bundle == null)
                {
                    //unable to retrieve bundle
                    if (bundleName != "")
                    {
                        CoreLogger.LogWarning(assetManager.LoggerModule, string.Format("unable to load bundle {0} for asset {1} - will try to load locally", bundleName, path));
                    }

                    _request = Resources.LoadAsync(path);
                    yield return(_request);

                    _result = _request.asset as T;
                    if (_result != null)
                    {
                        InvokeResultSet();
                    }
                    yield break;
                }

                string assetName = assetManager.GetAssetName(path);

                _bundleRequest = _bundle.LoadAssetAsync(assetName, typeof(T));
                CoreLogger.LogInfo(assetManager.LoggerModule, string.Format("requesting load of asset {0} from bundle {1} - waiting...", assetName, bundleName));
                yield return(_bundleRequest);

                _result = _bundleRequest.asset as T;
                if (_result == null)
                {
                    CoreLogger.LogWarning(assetManager.LoggerModule, string.Format("failed to retrieve asset {0} from bundle {1} - will try to load locally", path, bundleName));
                    _request = Resources.LoadAsync(path);
                    yield return(_request);

                    _result = _request.asset as T;
                    yield break;
                }

                InvokeResultSet();

                CoreLogger.LogInfo(assetManager.LoggerModule, string.Format("finished loading asset {0}", path));
            }
        /// <summary>
        /// This method runs once in the Module life.
        /// In this method, you can do registrations of the not UI related components.
        /// (eg: datasource, plugin)
        /// </summary>
        public void Integrate()
        {
            // Register OceanCoursePlugin._1_CoreAndServices.HelloWorldWorkstep
            HelloWorldWorkstep helloworldworkstepInstance = new HelloWorldWorkstep();

            PetrelSystem.WorkflowEditor.Add(helloworldworkstepInstance);

            CoreLogger.Info($"{ClassName}: {MethodBase.GetCurrentMethod().Name}");
        }
示例#17
0
        public static void Entry(Application application, string[] args)
        {
            CoreLogger.Info("Initiallize SharpEngine");
            ClientLogger.Warn("Initialize Client");



            application.Run();
        }
示例#18
0
        //FIXME queue all scene switches, whether additive or not, as tasks

        /// <summary>
        /// Switches to the scene specified by newScene. The sequence of operation is:
        /// first the current scene receives a notification that it is about to be unloaded.
        /// It then has time to prepare and do whatever it needs, until the timeout passes,
        /// or it signals that it is ready by setting its ReadyToUnload flag to true.
        /// Once either happens, the old scene receives a SceneClosing notification,
        /// and the loading of the new scene begins.
        /// Note that Unity does not guaranteee anything concerning the actual time it
        /// takes to load/unload a scene - once the call to LoadLeve is made, the scenes
        /// should consider themselves to be in Limbo and presume nothing.
        /// </summary>
        /// <param name="newScene">Name of the new scene to switch to.</param>
        /// <param name="handovers">If passed, contains a collection of objects that will
        /// be preserved for passing on to the next scene </param>
        public void SwitchScene(string newScene, IEnumerable <IEnumerableAction> preloadActions)
        {
            string realScene = _sceneMapping[newScene];

            CoreLogger.LogDebug(LoggerModules.SceneManager, string.Format("requested scene {0} (mapped to {1})", newScene, realScene));

            SceneRequested(realScene);

            GetLoader(realScene, defaultSceneTransition, preloadActions).Start();
        }
        }//End detectMulti All


        private void coinExists(String suspectFileName)
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Out.WriteLine("  You tried to import a coin that has already been imported: " + suspectFileName);
            CoreLogger.Log("  You tried to import a coin that has already been imported: " + suspectFileName);
            File.Move(this.fileUtils.suspectFolder + suspectFileName, this.fileUtils.trashFolder + suspectFileName);
            Console.Out.WriteLine("  Suspect CloudCoin was moved to Trash folder.");
            CoreLogger.Log("  Suspect CloudCoin was moved to Trash folder.");
            Console.ForegroundColor = ConsoleColor.White;
        }//end coin exists
        void OnLevelLoaded(int level)
        {
            float loadTime   = Time.realtimeSinceStartup - _levelLoadStart;
            int   loadFrames = Time.frameCount - _levelLoadStartFrame;

            _levelLoadStart      = -1f;
            _levelLoadStartFrame = -1;

            CoreLogger.LogDebug(LoggerModules.SceneManager, string.Format("requested scene {0} was loaded; loading took {1} seconds and {2} frames", _sceneName, loadTime, loadFrames));
        }
示例#21
0
 public static void CoreError(object message, Exception ex = null)
 {
     if (message is string)
     {
         CoreLogger.Error(ex, message as string);
     }
     else
     {
         CoreLogger.Error(ex, message.ToString());
     }
 }
示例#22
0
 public static void CoreVerbose(object message)
 {
     if (message is string)
     {
         CoreLogger.Verbose(message as string);
     }
     else
     {
         CoreLogger.Verbose(message.ToString());
     }
 }
示例#23
0
 public static void CoreWarn(object message)
 {
     if (message is string)
     {
         CoreLogger.Warning(message as string);
     }
     else
     {
         CoreLogger.Warning(message.ToString());
     }
 }
示例#24
0
 public static void CoreInfo(object message)
 {
     if (message is string)
     {
         CoreLogger.Information(message as string);
     }
     else
     {
         CoreLogger.Information(message.ToString());
     }
 }
示例#25
0
 public static void CoreFatal(object message)
 {
     if (message is string)
     {
         CoreLogger.Fatal(message as string);
     }
     else
     {
         CoreLogger.Fatal(message.ToString());
     }
 }
        override protected void Awake()
        {
            base.Awake();

            if (s_activeControllers.Count > 0)
            {
                if (s_activeControllers.FirstOrDefault(c => c.SceneName == SceneName) != null)
                {
                    CoreLogger.LogWarning(LoggerModules.SceneManager, string.Format("scene controller with name {0} already active!", SceneName));
                }
                else
                {
                    CoreLogger.LogWarning(LoggerModules.SceneManager, string.Format("scene controller {0} awakening while there are other active controllers!", SceneName));
                }
            }

            s_activeControllers.Add(this);

            CoreLogger.LogDebug(LoggerModules.SceneManager, string.Format("scene controller for scene {0} awakening and setting itself current instead of {1}",
                                                                          SceneName, s_current.Target == null ? "null" : s_current.Target.SceneName));
            s_current.Target = this;

#if UNITY_EDITOR
            //a testing scene would not be a part of the build
            if (sceneType == SceneType.Testing)
            {
                if (s_jumpToInitOnTestScenes)
                {
                    s_jumpToInitOnTestScenes = false;
                    string temp = forceInitScene;
                    forceInitScene = "";
                    GameApplication.RequestingScene = Application.loadedLevelName;
                    Application.LoadLevel(temp);
                    return;
                }
            }

            if (Application.loadedLevel != 0 && GameApplication.RequestingScene == "")
            {
                GameApplication.RequestingScene = Application.loadedLevelName;

                if (forceInitScene != "")
                {
                    Application.LoadLevel(forceInitScene);
                }
                else
                {
                    Application.LoadLevel(0);
                }
            }
#endif
        }
        public void OnSceneClosing()
        {
            if (_readyToUnload)
            {
                CoreLogger.LogDebug(LoggerModules.SceneManager, string.Format("scene {0} received SceneClosing", SceneName));
            }
            else
            {
                CoreLogger.LogWarning(LoggerModules.SceneManager, string.Format("scene {0} received SceneClosing without being ready!", SceneName));

                //FIXME: better terminate all exits and stuff?
            }
        }
示例#28
0
        protected void Reactivate()
        {
            if (!reactivate)
            {
                return;
            }

            foreach (GameObject go in _deactivations)
            {
                CoreLogger.LogInfo(LoggerModules.SceneManager, string.Format("SceneLoader reactivating {0}", go.name));
                go.SetActive(true);
            }
        }
示例#29
0
        public void Release(T element)
        {
#if DEBUG
            if (m_Stack.Contains(element))
            {
                CoreLogger.Error("ObjectPool", "the element has been released");
                return;
            }
#endif

            m_ReleaseItemFunc?.Invoke(element);
            m_Stack.Push(element);
        }
示例#30
0
        public void Release(T element)
        {
#if DEBUG
            if (m_Stack.Contains(element))
            {
                CoreLogger.Error("ObjectPool", "GenericObjectPool::Release->The element has been push into pool!");
                return;
            }
#endif

            m_OnRelease?.Invoke(element);
            m_Stack.Push(element);
        }