Пример #1
0
        public MemoryContext(MemoryParameters parameters, MemoryDependencies dependencies, MemoryConfiguration configuration, MemoryHooks hooks)
        {
            this.parameters    = parameters;
            this.dependencies  = dependencies;
            this.configuration = configuration;
            this.hooks         = hooks;

            collection = new MemoryCollection(this);
        }
Пример #2
0
        private void OutputAlertText()
        {
            this.m_sb.Length = 0;
            this.m_sb.AppendFormat("{0}분 전의 메모리 사용량 보다 {1}% 증가되었습니다. (현재 메모리={2} bytes, 이전 메모리={3} bytes)\n", new object[]
            {
                MemoryMonitor.cycleTime,
                (int)((float)(this.m_curTotalSize - this.m_preTotalSize) / (float)this.m_preTotalSize * 100f),
                this.m_curTotalSize.ToString("###,###,###"),
                this.m_preTotalSize.ToString("###,###,###")
            });
            this.m_sb.AppendFormat("최근 {0}회 동안 평균 메모리 증가량 = {1} bytes{2}\n", this.m_growUpHistory.Count, this.m_EverageGrowUpBytes.ToString("###,###,###"), (this.m_EverageGrowUpBytes <= MemoryMonitor.growUpAllowedBytes) ? string.Empty : " => 평균 메모리 증가량이 너무 높습니다. (주의)");
            this.m_sb.AppendLine();
            foreach (CollectionSummary current in MemoryCollection.CollectionSummaries())
            {
                this.m_sb.AppendLine("=========================================================================");
                this.m_sb.AppendFormat("[{0}] 오브젝트 총 개수={1}, 오브젝트 총 크기={2} bytes\n", current.collectionType, current.cllectedCount, (current.collectedSize != 0) ? current.collectedSize.ToString("###,###,###") : "<unknown>");
                int num = 0;
                this.m_sb.AppendLine("=========================================================================");
                this.m_sb.AppendLine("<<새로운 오브젝트 중 Top 10>>");
                foreach (LoadedUnityItem current2 in current.TopRanker(10, true))
                {
                    this.m_sb.AppendFormat("   # {0}. \"{1}\" ( {2} bytes )\n", ++num, current2.objectName, (current2.objectBytes != 0) ? current2.objectBytes.ToString("###,###,###") : "0");
                }
                this.m_sb.AppendLine();
                num = 0;
                this.m_sb.AppendLine("<<모든 오브젝트 중 Top 10>>");
                foreach (LoadedUnityItem current3 in current.TopRanker(10, false))
                {
                    this.m_sb.AppendFormat("   [{4}] \"{1}\" ( Hits = {3}, Size = {2} bytes )\n", new object[]
                    {
                        ++num,
                        current3.objectName,
                        (current3.objectBytes != 0) ? current3.objectBytes.ToString("###,###,###") : "0",
                        current3.hitCount,
                        current3.objectType
                    });
                }
                this.m_sb.AppendLine();
                int newlyObjectTotalSize = current.GetNewlyObjectTotalSize();
                int leakObjectTotalSize  = current.GetLeakObjectTotalSize();
                this.m_sb.AppendFormat("새로운 오브젝트 총 용량 = {0} bytes\n", (newlyObjectTotalSize != 0) ? newlyObjectTotalSize.ToString("###,###,###") : "?");
                this.m_sb.AppendFormat("릭 오브젝트 총 용량 = {0} bytes\n", (leakObjectTotalSize != 0) ? leakObjectTotalSize.ToString("###,###,###") : "?");
                this.m_sb.AppendFormat("모든 오브젝트 총 용량 = {0} bytes\n", (current.collectedSize != 0) ? current.collectedSize.ToString("###,###,###") : "?");
                this.m_sb.AppendLine();
            }
            this.m_sb.AppendLine("=========================================================================");
            this.m_sb.AppendFormat("현재 사용중인 메모리 크기 (heap size) = {0} bytes", Profiler.usedHeapSize.ToString("#,###,###,###"));
            this.m_sb.AppendLine();
            this.m_DisplayText = this.m_sb.ToString();
            string text = DateTime.Now.ToString();

            TsLog.Log("[MemoryMonitor] {0}\n{1}", new object[]
            {
                text,
                this.m_DisplayText
            });
        }
Пример #3
0
        private void setCurrentStateData(Net <T> net, MemoryCollection rgSamples)
        {
            List <SimpleDatum> rgData0 = rgSamples.GetCurrentStateData();
            List <SimpleDatum> rgClip0 = rgSamples.GetCurrentStateClip();

            SimpleDatum[] rgData = rgData0.ToArray();
            SimpleDatum[] rgClip = (rgClip0 != null) ? rgClip0.ToArray() : null;

            setData(net, rgData, rgClip);
        }
Пример #4
0
        private static void InterfaceExtensions()
        {
            IProductCollection collection = new MemoryCollection();

            Console.WriteLine($"Found items for Beans? {collection.GetProductByName("Beans")?.Any()}");

            //The derived class also has access to the extension because the are declared by interface
            IProductCollection romCollection = new RomMemoryCollection("Eprom");

            Console.WriteLine($"Found items for Meat? {romCollection.GetProductByName("Meat")?.Any()}");
        }
Пример #5
0
        private void Start()
        {
            if (this.RedRing == null)
            {
                return;
            }
            Texture texture = this.RedRing.texture;

            this.m_TextureSizeRate = (float)texture.width / (float)texture.height;
            this.RedRing.color     = Color.red;
            this.RedRing.enabled   = false;
            this.m_curTotalSize    = MemoryCollection.Monitoring();
            float num = (float)MemoryMonitor.cycleTime * 60f;

            base.InvokeRepeating("Monitoring", num, num);
        }
Пример #6
0
 private void Monitoring()
 {
     try
     {
         this.m_preTotalSize = this.m_curTotalSize;
         this.m_curTotalSize = MemoryCollection.Monitoring();
         if (this.m_growUpHistory.Count == 10)
         {
             this.m_growUpHistory.RemoveAt(0);
         }
         this.m_growUpHistory.Add(this.m_curTotalSize - this.m_preTotalSize);
         int num = 0;
         foreach (int current in this.m_growUpHistory)
         {
             num += current;
         }
         this.m_EverageGrowUpBytes = num / this.m_growUpHistory.Count;
         float num2 = (float)(this.m_curTotalSize - this.m_preTotalSize) / (float)this.m_preTotalSize;
         if (num2 > MemoryMonitorBehaviour.GROWUP_RATE || this.m_EverageGrowUpBytes > MemoryMonitor.growUpAllowedBytes)
         {
             this.OutputAlertText();
             this.ShowAlert(30f);
         }
         else
         {
             TsLog.Log("[MemoryMonitor] (^ㅁ^)/ \"좋아요. 메모리 증가가 크지 않습니다.\" (증가율={0}%)", new object[]
             {
                 (int)(num2 * 100f)
             });
         }
     }
     catch (DivideByZeroException ex)
     {
         TsLog.LogWarning("[MemoryMonitor] 이전에 수집된 로딩된 오브젝트들의 메모리 크기가 0입니다. ({0})", new object[]
         {
             ex
         });
     }
     catch (Exception ex2)
     {
         TsLog.LogWarning("[MemoryMonitor] {0}", new object[]
         {
             ex2
         });
     }
 }
Пример #7
0
        /// <summary>
        /// Train the model at the current iteration.
        /// </summary>
        /// <param name="nIteration">Specifies the current iteration.</param>
        /// <param name="rgSamples">Contains the samples to train the model with along with the priorities associated with the samples.</param>
        /// <param name="nActionCount">Specifies the number of actions in the action set.</param>
        public void Train(int nIteration, MemoryCollection rgSamples, int nActionCount)
        {
            m_rgSamples = rgSamples;

            if (m_nActionCount != nActionCount)
            {
                throw new Exception("The logit output of '" + m_nActionCount.ToString() + "' does not match the action count of '" + nActionCount.ToString() + "'!");
            }

            // Get next_q_values
            m_mycaffe.Log.Enable = false;
            setNextStateData(m_netTarget, rgSamples);
            m_netTarget.ForwardFromTo(0, m_netTarget.layers.Count - 2);

            setCurrentStateData(m_netOutput, rgSamples);
            m_memLoss.OnGetLoss += m_memLoss_ComputeTdLoss;

            if (m_nMiniBatch == 1)
            {
                m_solver.Step(1);
            }
            else
            {
                m_solver.Step(1, TRAIN_STEP.NONE, true, m_bUseAcceleratedTraining, true, true);
                m_colAccumulatedGradients.Accumulate(m_mycaffe.Cuda, m_netOutput.learnable_parameters, true);

                if (nIteration % m_nMiniBatch == 0)
                {
                    m_netOutput.learnable_parameters.CopyFrom(m_colAccumulatedGradients, true);
                    m_colAccumulatedGradients.SetDiff(0);
                    m_dfLearningRate = m_solver.ApplyUpdate(nIteration);
                    m_netOutput.ClearParamDiffs();
                }
            }

            m_memLoss.OnGetLoss -= m_memLoss_ComputeTdLoss;
            m_mycaffe.Log.Enable = true;

            resetNoise(m_netOutput);
            resetNoise(m_netTarget);
        }
Пример #8
0
    public void ProcessCommand(NrCommandInterpreter.NrCommand command)
    {
        string strCommand = command.m_strCommand;

        switch (strCommand)
        {
        case "help":
            this.CommandHelp();
            return;

        case "cls":
            NrTSingleton <NrDebugConsole> .Instance.ClearScreen();

            return;

        case "list":
        {
            string text = command.m_arArg[0];
            if (text != null)
            {
                if (NrCommandInterpreter.< > f__switch$map6 == null)
                {
                    NrCommandInterpreter.< > f__switch$map6 = new Dictionary <string, int>(2)
                    {
                        {
                            "char",
                            0
                        },
                        {
                            "packet",
                            1
                        }
                    };
                }
                int num2;
                if (NrCommandInterpreter.< > f__switch$map6.TryGetValue(text, out num2))
                {
                    if (num2 != 0)
                    {
                        if (num2 == 1)
                        {
                            this.ShowPacketHistory(command);
                        }
                    }
                    else
                    {
                        this.CommandCharList();
                    }
                }
            }
            return;
        }

        case "set":
        {
            List <string> arArg = command.m_arArg;
            string        text  = command.m_arArg[0];
            switch (text)
            {
            case "mem.monitor":
                if (arArg.Count >= 2)
                {
                    bool flag = Utility.ParseBoolean(arArg[1], false);
                    if (flag)
                    {
                        if (MemoryMonitor.Start())
                        {
                            NrTSingleton <NrDebugConsole> .Instance.Print("메모리 모니터링이 시작되었습니다. ({0}분 마다 메모리 검사 진행)", new object[]
                                {
                                    MemoryMonitor.cycleTime
                                });
                        }
                    }
                    else if (MemoryMonitor.Stop())
                    {
                        NrTSingleton <NrDebugConsole> .Instance.Print("메모리 모니터링이 종료되었습니다.");
                    }
                }
                break;

            case "mem.monitor.cycle":
            {
                int num3;
                if (arArg.Count >= 2 && int.TryParse(arArg[1], out num3))
                {
                    MemoryMonitor.cycleTime = num3;
                    NrTSingleton <NrDebugConsole> .Instance.Print(string.Format(" => 모니터링 주기가 {0}분으로 설정되었습니다. 해당 설정은 게임 재시작시 적용됩니다.", num3));
                }
                break;
            }

            case "mem.monitor.growup":
            {
                int num4;
                if (arArg.Count >= 2 && int.TryParse(arArg[1], out num4))
                {
                    MemoryMonitor.growUpAllowedSize = num4;
                    NrTSingleton <NrDebugConsole> .Instance.Print(string.Format("평균 증가량이 {0}MB 보다 크면, 경고 화면을 보여줍니다.", num4));
                }
                break;
            }

            case "showhide":
            {
                short      charunique       = Convert.ToInt16(command.m_arArg[1]);
                NrCharBase charByCharUnique = NrTSingleton <NkCharManager> .Instance.GetCharByCharUnique(charunique);

                if (command.m_arArg[2] == "true")
                {
                    charByCharUnique.SetShowHide3DModel(true, true, true);
                }
                else
                {
                    charByCharUnique.SetShowHide3DModel(false, false, false);
                }
                break;
            }

            case "charpos":
            {
                short      charunique2       = Convert.ToInt16(command.m_arArg[1]);
                NrCharBase charByCharUnique2 = NrTSingleton <NkCharManager> .Instance.GetCharByCharUnique(charunique2);

                Vector3 localPosition = charByCharUnique2.Get3DChar().GetRootGameObject().transform.localPosition;
                localPosition.y = 150f;
                charByCharUnique2.Get3DChar().GetRootGameObject().transform.localPosition = localPosition;
                NrTSingleton <NrDebugConsole> .Instance.Print(charByCharUnique2.Get3DChar().GetRootGameObject().name);

                break;
            }

            case "log":
                if (command.m_arArg[1].Contains("true"))
                {
                    NrTSingleton <NrGlobalReference> .Instance.IsEnableLog = true;
                    PlayerPrefs.SetInt("EnableLog", 1);
                    NrTSingleton <NrDebugConsole> .Instance.Print("log Enable.");
                }
                else
                {
                    NrTSingleton <NrGlobalReference> .Instance.IsEnableLog = false;
                    PlayerPrefs.SetInt("EnableLog", 0);
                    NrTSingleton <NrDebugConsole> .Instance.Print("log Disable.");
                }
                break;

            case "localwww":
            {
                string text2 = command.m_arArg[1];
                if (text2 != null)
                {
                    if (NrCommandInterpreter.< > f__switch$map7 == null)
                    {
                        NrCommandInterpreter.< > f__switch$map7 = new Dictionary <string, int>(2)
                        {
                            {
                                "on",
                                0
                            },
                            {
                                "off",
                                1
                            }
                        };
                    }
                    int num5;
                    if (NrCommandInterpreter.< > f__switch$map7.TryGetValue(text2, out num5))
                    {
                        if (num5 != 0)
                        {
                            if (num5 == 1)
                            {
                                NrTSingleton <NrGlobalReference> .Instance.localWWW = false;
                                PlayerPrefs.SetInt("LocalWWW", 0);
                                NrTSingleton <NrDebugConsole> .Instance.Print("set local www off");
                            }
                        }
                        else
                        {
                            NrTSingleton <NrGlobalReference> .Instance.localWWW = true;
                            PlayerPrefs.SetInt("LocalWWW", 1);
                            NrTSingleton <NrDebugConsole> .Instance.Print("set local www on");
                        }
                    }
                }
                break;
            }

            case "basepath":
                NrTSingleton <NrGlobalReference> .Instance.basePath = command.m_arArg[1];
                NrTSingleton <NrDebugConsole> .Instance.Print("basepath set to " + NrTSingleton <NrGlobalReference> .Instance.basePath);

                break;

            case "ndt":
            {
                string a = command.m_arArg[1];
                if (a == "off")
                {
                    NrTSingleton <NrGlobalReference> .Instance.useCache = true;
                    NrTSingleton <NrDebugConsole> .Instance.Print("set to using Assetbundle Table");
                }
                else
                {
                    NrTSingleton <NrGlobalReference> .Instance.useCache = false;
                    NrTSingleton <NrDebugConsole> .Instance.Print("set to using NDT Table");
                }
                PlayerPrefs.SetInt("UseNDT", (!NrTSingleton <NrGlobalReference> .Instance.useCache) ? 0 : 1);
                break;
            }

            case "cache":
            {
                string text2 = command.m_arArg[1];
                switch (text2)
                {
                case "on":
                    NrTSingleton <NrGlobalReference> .Instance.useCache = true;
                    PlayerPrefs.SetInt("UseCache", 1);
                    NrTSingleton <NrDebugConsole> .Instance.Print("set cache On");

                    break;

                case "off":
                    NrTSingleton <NrGlobalReference> .Instance.useCache = false;
                    PlayerPrefs.SetInt("UseCache", 0);
                    NrTSingleton <NrDebugConsole> .Instance.Print("set cache Off");

                    break;

                case "clean":
                    Caching.CleanCache();
                    NrTSingleton <NrDebugConsole> .Instance.Print("cleaning cache space...");

                    break;
                }
                break;
            }

            case "clear":
                PlayerPrefs.DeleteAll();
                NrTSingleton <NrDebugConsole> .Instance.Print("All PlayerPrefs are cleared.");

                break;

            case "sound":
            {
                string text2 = command.m_arArg[1];
                if (text2 != null)
                {
                    if (NrCommandInterpreter.< > f__switch$map9 == null)
                    {
                        NrCommandInterpreter.< > f__switch$map9 = new Dictionary <string, int>(2)
                        {
                            {
                                "on",
                                0
                            },
                            {
                                "off",
                                1
                            }
                        };
                    }
                    int num5;
                    if (NrCommandInterpreter.< > f__switch$map9.TryGetValue(text2, out num5))
                    {
                        if (num5 != 0)
                        {
                            if (num5 == 1)
                            {
                                TsAudio.SetDisableDownloadAllAudio(true);
                                NrTSingleton <NrDebugConsole> .Instance.Print("set sound off");
                            }
                        }
                        else
                        {
                            TsAudio.SetDisableDownloadAllAudio(false);
                            NrTSingleton <NrDebugConsole> .Instance.Print("set sound on");
                        }
                    }
                }
                break;
            }

            case "framerate":
            {
                int targetFrameRate = int.Parse(command.m_arArg[1]);
                Application.targetFrameRate = targetFrameRate;
                NrTSingleton <NrDebugConsole> .Instance.Print("Set FrameRate {0}", new object[]
                        {
                            targetFrameRate.ToString()
                        });

                break;
            }
            }
            return;
        }

        case "clear":
        {
            string text = command.m_arArg[0];
            if (text != null)
            {
                if (NrCommandInterpreter.< > f__switch$mapB == null)
                {
                    NrCommandInterpreter.< > f__switch$mapB = new Dictionary <string, int>(1)
                    {
                        {
                            "bundle",
                            0
                        }
                    };
                }
                int num2;
                if (NrCommandInterpreter.< > f__switch$mapB.TryGetValue(text, out num2))
                {
                    if (num2 == 0)
                    {
                        if (command.m_arArg.Count >= 2)
                        {
                            string name = command.m_arArg[1];
                            Holder.ClearStackItem(name, false);
                        }
                    }
                }
            }
            return;
        }

        case "call":
        {
            string text = command.m_arArg[0];
            switch (text)
            {
            case "bundle.clear":
                Resources.UnloadUnusedAssets();
                NrTSingleton <NrDebugConsole> .Instance.Print("called Resources.UnloadUnusedAssets()");

                break;

            case "gc":
                GC.Collect();
                NrTSingleton <NrDebugConsole> .Instance.Print("called garbage collection.");

                break;

            case "bundle.unload":
                if (command.m_arArg.Count >= 2)
                {
                    string text3 = command.m_arArg[1];
                    Holder.RemoveWWWItem(text3, false);
                    Resources.UnloadUnusedAssets();
                    NrTSingleton <NrDebugConsole> .Instance.Print("unload => \"{0}\"", new object[]
                        {
                            text3
                        });
                }
                else
                {
                    Resources.UnloadUnusedAssets();
                    NrTSingleton <NrDebugConsole> .Instance.Print("called Resources.UnloadUnusedAssets()");
                }
                break;
            }
            return;
        }

        case "quit":
            NrTSingleton <NrMainSystem> .Instance.QuitGame(false);

            return;

        case "show":
        {
            string text = command.m_arArg[0];
            switch (text)
            {
            case "mem.growup":
                MemoryCollection.Print(MemoryCollection.Mode.NewlyLeakOnly);
                goto IL_1E8D;

            case "mem.leak":
                MemoryCollection.Print(MemoryCollection.Mode.AllLeaks);
                goto IL_1E8D;

            case "mem.all":
                MemoryCollection.Print(MemoryCollection.Mode.LoadedAll);
                goto IL_1E8D;

            case "mem.newl":
                MemoryCollection.Print(MemoryCollection.Mode.NewObjectOnly);
                goto IL_1E8D;

            case "mem.monitor":
                MemoryMonitor.Show(180f);
                goto IL_1E8D;

            case "mem.monitor.cycle":
                NrTSingleton <NrDebugConsole> .Instance.Print(string.Format(" => {0}분 마다 메모리 모니터링을 합니다. (현재 로딩되어 있는 오브젝트 수집 및 경고)", MemoryMonitor.cycleTime));

                goto IL_1E8D;

            case "mem.monitor.growup":
                NrTSingleton <NrDebugConsole> .Instance.Print(string.Format("평균 증가량이 {0}MB 보다 크면, 경고 화면을 보여줍니다.", MemoryMonitor.growUpAllowedSize));

                goto IL_1E8D;

            case "packet":
                this.ShowPacketInfo(command);
                goto IL_1E8D;

            case "bundle":
            {
                string text4;
                if (command.m_arArg.Count < 2)
                {
                    text4 = Holder.DbgPrint_BundleList();
                }
                else
                {
                    text4 = Holder.DbgPrint_BundleList(command.m_arArg[1]);
                }
                if (!string.IsNullOrEmpty(text4))
                {
                    NrTSingleton <NrDebugConsole> .Instance.Print(text4);

                    TsLog.Log("[TsBundle] {0}", new object[]
                            {
                                text4
                            });
                }
                goto IL_1E8D;
            }

            case "bundlecnt":
            {
                string text5 = Holder.DbgPrint_BundleCount();
                NrTSingleton <NrDebugConsole> .Instance.Print(text5);

                TsLog.Log("[TsBundle] {0}", new object[]
                        {
                            text5
                        });
                goto IL_1E8D;
            }

            case "downloaded":
                NrTSingleton <NrDebugConsole> .Instance.Print(Holder.DbgPrint_Downloaded());

                goto IL_1E8D;

            case "bundleinfo":
                TsImmortal.bundleDbgPrint.enabled = !TsImmortal.bundleDbgPrint.enabled;
                goto IL_1E8D;

            case "char":
                this.CommandCharInfo(command);
                goto IL_1E8D;

            case "basepath":
                NrTSingleton <NrDebugConsole> .Instance.Print(NrTSingleton <NrGlobalReference> .Instance.basePath);

                goto IL_1E8D;

            case "cache":
            {
                NrTSingleton <NrDebugConsole> .Instance.Print("Cache Active : " + NrTSingleton <NrGlobalReference> .Instance.useCache.ToString());

                long num6 = Caching.spaceFree / 1048576L;
                NrTSingleton <NrDebugConsole> .Instance.Print(" Free space : " + num6.ToString() + "MB");

                goto IL_1E8D;
            }

            case "autopath":
                NrTSingleton <NrDebugConsole> .Instance.Print(NrTSingleton <NrAutoPath> .Instance.GetDebug());

                goto IL_1E8D;

            case "quest":
                NrTSingleton <NrDebugConsole> .Instance.Print(NrTSingleton <NkQuestManager> .Instance.GetDebugMsg());

                goto IL_1E8D;

            case "config":
                NrTSingleton <NrDebugConsole> .Instance.Print("Local WWW : " + NrTSingleton <NrGlobalReference> .Instance.localWWW.ToString());

                NrTSingleton <NrDebugConsole> .Instance.Print("BasePath : " + NrTSingleton <NrGlobalReference> .Instance.basePath);

                NrTSingleton <NrDebugConsole> .Instance.Print("LocalPath : " + Option.GetProtocolRootPath(Protocol.FILE));

                NrTSingleton <NrDebugConsole> .Instance.Print("WebPath : " + Option.GetProtocolRootPath(Protocol.HTTP));

                NrTSingleton <NrDebugConsole> .Instance.Print("Cache Active : " + NrTSingleton <NrGlobalReference> .Instance.useCache);

                NrTSingleton <NrDebugConsole> .Instance.Print("Loging Active : " + NrTSingleton <NrGlobalReference> .Instance.IsEnableLog);

                NrTSingleton <NrDebugConsole> .Instance.Print("Audio Options : ");

                for (EAudioType eAudioType = EAudioType.SFX; eAudioType < EAudioType.TOTAL; eAudioType++)
                {
                    NrTSingleton <NrDebugConsole> .Instance.Print(" - Audio " + eAudioType.ToString() + " : " + (!TsAudio.IsDisableDownloadAudio(eAudioType)).ToString());
                }
                goto IL_1E8D;

            case "usetexture":
                TsMemLog.TextureByFormat();
                goto IL_1E8D;

            case "camera":
                NrTSingleton <NrDebugConsole> .Instance.Print(string.Concat(new object[]
                    {
                        "UICamera Height: ",
                        GUICamera.height,
                        " Width: ",
                        GUICamera.width
                    }));

                NrTSingleton <NrDebugConsole> .Instance.Print(string.Concat(new object[]
                    {
                        "MainCamera Height: ",
                        Screen.height,
                        "Width: ",
                        Screen.width
                    }));

                goto IL_1E8D;

            case "fps":
                NrTSingleton <NrDebugConsole> .Instance.Print("TargetFrameRate (FPS) = {0}", new object[]
                    {
                        Application.targetFrameRate
                    });

                goto IL_1E8D;

            case "version":
                NrTSingleton <NrDebugConsole> .Instance.Print("UnityVersion = {0}", new object[]
                    {
                        Application.unityVersion
                    });

                goto IL_1E8D;

            case "log":
                NrTSingleton <NrDebugConsole> .Instance.Print(string.Format("debugLog => {0}", (!NrTSingleton <NrGlobalReference> .Instance.IsEnableLog) ? "Disabled" : "Enabled"));

                goto IL_1E8D;

            case "stage":
            {
                string str = StageSystem.ToStringStatus();
                NrTSingleton <NrDebugConsole> .Instance.Print(str);

                goto IL_1E8D;
            }

            case "dlginfo":
                NrTSingleton <NrDebugConsole> .Instance.Print(NrTSingleton <FormsManager> .Instance.GetDlgStatus());

                goto IL_1E8D;

            case "monhp":
                if (Scene.IsCurScene(Scene.Type.BATTLE))
                {
                    string         text6     = string.Empty;
                    NkBattleChar[] charArray = NrTSingleton <NkBattleCharManager> .Instance.GetCharArray();

                    if (charArray != null)
                    {
                        for (int i = 0; i < charArray.Length; i++)
                        {
                            NkBattleChar nkBattleChar = charArray[i];
                            if (nkBattleChar != null)
                            {
                                text6 += string.Format("{0} : {1} / {2}\r\n", nkBattleChar.Get3DName(), nkBattleChar.GetSoldierInfo().GetHP(), nkBattleChar.GetMaxHP(false));
                            }
                        }
                        NrTSingleton <NrDebugConsole> .Instance.Print(text6);
                    }
                }
                goto IL_1E8D;

            case "path":
            {
                string text2 = command.m_arArg[1];
                if (text2 != null)
                {
                    if (NrCommandInterpreter.< > f__switch$mapD == null)
                    {
                        NrCommandInterpreter.< > f__switch$mapD = new Dictionary <string, int>(2)
                        {
                            {
                                "on",
                                0
                            },
                            {
                                "off",
                                1
                            }
                        };
                    }
                    int num5;
                    if (NrCommandInterpreter.< > f__switch$mapD.TryGetValue(text2, out num5))
                    {
                        if (num5 != 0)
                        {
                            if (num5 == 1)
                            {
                                GMCommand_Dlg.m_bShowNavPath = false;
                                NrTSingleton <NrDebugConsole> .Instance.Print("Show Move Path : false");
                            }
                        }
                        else
                        {
                            GMCommand_Dlg.m_bShowNavPath = true;
                            NrTSingleton <NrDebugConsole> .Instance.Print("Show Move Path : true");
                        }
                    }
                }
                goto IL_1E8D;
            }

            case "qu":
            {
                TsQualityManager.Level qualitySettings = TsQualityManager.Level.LOWEST;
                string text2 = command.m_arArg[1];
                switch (text2)
                {
                case "0":
                    qualitySettings = TsQualityManager.Level.LOWEST;
                    break;

                case "1":
                    qualitySettings = TsQualityManager.Level.MEDIUM;
                    break;

                case "2":
                    qualitySettings = TsQualityManager.Level.HIGHEST;
                    break;
                }
                CustomQuality.GetInstance().SetQualitySettings(qualitySettings);
                goto IL_1E8D;
            }

            case "tx":
            {
                string text2 = command.m_arArg[1];
                switch (text2)
                {
                case "0":
                    QualitySettings.masterTextureLimit = 0;
                    break;

                case "1":
                    QualitySettings.masterTextureLimit = 1;
                    break;

                case "2":
                    QualitySettings.masterTextureLimit = 2;
                    break;

                case "4":
                    QualitySettings.masterTextureLimit = 4;
                    break;
                }
                goto IL_1E8D;
            }

            case "charinfo":
            {
                GameObject gameObject = GameObject.Find(NrTSingleton <NkCharManager> .Instance.GetCharName());
                if (gameObject != null)
                {
                    Renderer[] componentsInChildren = gameObject.GetComponentsInChildren <Renderer>();
                    Renderer[] array = componentsInChildren;
                    for (int j = 0; j < array.Length; j++)
                    {
                        Renderer renderer = array[j];
                        if (renderer != null)
                        {
                            if (renderer as SkinnedMeshRenderer)
                            {
                                NrTSingleton <NrDebugConsole> .Instance.Print("======================");

                                SkinnedMeshRenderer skinnedMeshRenderer = renderer as SkinnedMeshRenderer;
                                skinnedMeshRenderer.castShadows    = false;
                                skinnedMeshRenderer.receiveShadows = false;
                                NrTSingleton <NrDebugConsole> .Instance.Print("SkinQuality : " + skinnedMeshRenderer.quality);

                                NrTSingleton <NrDebugConsole> .Instance.Print("R Shadow : " + skinnedMeshRenderer.receiveShadows);

                                NrTSingleton <NrDebugConsole> .Instance.Print("Update : " + skinnedMeshRenderer.updateWhenOffscreen);

                                if (renderer.material != null)
                                {
                                    NrTSingleton <NrDebugConsole> .Instance.Print("Material : " + renderer.material.name);

                                    NrTSingleton <NrDebugConsole> .Instance.Print("Shader Name : " + renderer.material.shader.name);

                                    if (renderer.material.mainTexture != null)
                                    {
                                        Texture2D texture2D = renderer.material.mainTexture as Texture2D;
                                        NrTSingleton <NrDebugConsole> .Instance.Print("Texture : " + renderer.material.mainTexture.name);

                                        NrTSingleton <NrDebugConsole> .Instance.Print("anisoLevel : " + renderer.material.mainTexture.anisoLevel);

                                        NrTSingleton <NrDebugConsole> .Instance.Print("filterMode : " + renderer.material.mainTexture.filterMode);

                                        NrTSingleton <NrDebugConsole> .Instance.Print("masterTextureLimit : " + Texture.masterTextureLimit);

                                        NrTSingleton <NrDebugConsole> .Instance.Print("texelSize : " + renderer.material.mainTexture.texelSize.ToString());

                                        NrTSingleton <NrDebugConsole> .Instance.Print("width : " + renderer.material.mainTexture.width);

                                        NrTSingleton <NrDebugConsole> .Instance.Print("height : " + renderer.material.mainTexture.height);

                                        NrTSingleton <NrDebugConsole> .Instance.Print("mipMapBias : " + renderer.material.mainTexture.mipMapBias);

                                        if (texture2D != null)
                                        {
                                            NrTSingleton <NrDebugConsole> .Instance.Print("mipmapcount : " + texture2D.mipmapCount);

                                            NrTSingleton <NrDebugConsole> .Instance.Print("format : " + texture2D.format);

                                            NrTSingleton <NrDebugConsole> .Instance.Print("Wrap : " + texture2D.wrapMode);
                                        }
                                    }
                                }
                                Color color = renderer.material.color;
                                NrTSingleton <NrDebugConsole> .Instance.Print("R : " + color.r);

                                NrTSingleton <NrDebugConsole> .Instance.Print("G : " + color.g);

                                NrTSingleton <NrDebugConsole> .Instance.Print("b : " + color.b);

                                NrTSingleton <NrDebugConsole> .Instance.Print("a : " + color.a);

                                renderer.material.color = Color.white;
                                color = renderer.material.color;
                                NrTSingleton <NrDebugConsole> .Instance.Print("CR : " + color.r);

                                NrTSingleton <NrDebugConsole> .Instance.Print("CG : " + color.g);

                                NrTSingleton <NrDebugConsole> .Instance.Print("Cb : " + color.b);

                                NrTSingleton <NrDebugConsole> .Instance.Print("CA : " + color.a);
                            }
                            else if (renderer.material != null && renderer.material.name.Contains("Axe"))
                            {
                                Color color2 = renderer.material.color;
                                NrTSingleton <NrDebugConsole> .Instance.Print("CR : " + color2.r);

                                NrTSingleton <NrDebugConsole> .Instance.Print("CG : " + color2.g);

                                NrTSingleton <NrDebugConsole> .Instance.Print("Cb : " + color2.b);

                                NrTSingleton <NrDebugConsole> .Instance.Print("CA : " + color2.a);

                                NrTSingleton <NrDebugConsole> .Instance.Print("Material : " + renderer.material.name);

                                NrTSingleton <NrDebugConsole> .Instance.Print("Shader Name : " + renderer.material.shader.name);

                                if (renderer.material.mainTexture != null)
                                {
                                    Texture2D texture2D2 = renderer.material.mainTexture as Texture2D;
                                    NrTSingleton <NrDebugConsole> .Instance.Print("Texture : " + renderer.material.mainTexture.name);

                                    NrTSingleton <NrDebugConsole> .Instance.Print("anisoLevel : " + renderer.material.mainTexture.anisoLevel);

                                    NrTSingleton <NrDebugConsole> .Instance.Print("filterMode : " + renderer.material.mainTexture.filterMode);

                                    NrTSingleton <NrDebugConsole> .Instance.Print("masterTextureLimit : " + Texture.masterTextureLimit);

                                    NrTSingleton <NrDebugConsole> .Instance.Print("texelSize : " + renderer.material.mainTexture.texelSize.ToString());

                                    NrTSingleton <NrDebugConsole> .Instance.Print("width : " + renderer.material.mainTexture.width);

                                    NrTSingleton <NrDebugConsole> .Instance.Print("height : " + renderer.material.mainTexture.height);

                                    NrTSingleton <NrDebugConsole> .Instance.Print("mipMapBias : " + renderer.material.mainTexture.mipMapBias);

                                    if (texture2D2 != null)
                                    {
                                        NrTSingleton <NrDebugConsole> .Instance.Print("mipmapcount : " + texture2D2.mipmapCount);

                                        NrTSingleton <NrDebugConsole> .Instance.Print("format : " + texture2D2.format);

                                        NrTSingleton <NrDebugConsole> .Instance.Print("Wrap : " + texture2D2.wrapMode);
                                    }
                                }
                            }
                        }
                    }
                }
                UnityEngine.Object[] array2 = UnityEngine.Object.FindObjectsOfType(typeof(Light));
                UnityEngine.Object[] array3 = array2;
                for (int k = 0; k < array3.Length; k++)
                {
                    UnityEngine.Object @object = array3[k];
                    if (@object is Light)
                    {
                        Light light = @object as Light;
                        light.enabled = false;
                        NrTSingleton <NrDebugConsole> .Instance.Print("======================");

                        NrTSingleton <NrDebugConsole> .Instance.Print("Lighht: " + light.name);

                        NrTSingleton <NrDebugConsole> .Instance.Print("Lighht: " + light.enabled);

                        NrTSingleton <NrDebugConsole> .Instance.Print("Shadow: " + light.shadows.ToString());
                    }
                }
                goto IL_1E8D;
            }

            case "ev":
            {
                int nMapIndex = NrTSingleton <NkCharManager> .Instance.GetMyCharInfo().m_kCharMapInfo.m_nMapIndex;

                MapTriggerInfo mapTriggerInfo = EventTriggerMapManager.Instance.GetMapTriggerInfo(nMapIndex);
                if (mapTriggerInfo == null)
                {
                    return;
                }
                NrTSingleton <NrDebugConsole> .Instance.Print("======================");

                NrTSingleton <NrDebugConsole> .Instance.Print("EventTrigger Name");

                EventTrigger_Game[] trigger_Game = mapTriggerInfo.GetTrigger_Game();
                for (int l = 0; l < trigger_Game.Length; l++)
                {
                    EventTrigger_Game eventTrigger_Game = trigger_Game[l];
                    NrTSingleton <NrDebugConsole> .Instance.Print("{0}", new object[]
                            {
                                eventTrigger_Game.name
                            });
                }
                NrTSingleton <NrDebugConsole> .Instance.Print("======================");

                goto IL_1E8D;
            }

            case "evst":
            {
                int nMapIndex2 = NrTSingleton <NkCharManager> .Instance.GetMyCharInfo().m_kCharMapInfo.m_nMapIndex;

                EventTrigger_Game eventTrigger_Game2 = EventTriggerMapManager.Instance.GetEventTrigger(nMapIndex2, command.m_arArg[1]) as EventTrigger_Game;
                List <GameObject> eventConditionList = eventTrigger_Game2.EventConditionList;
                List <GameObject> stateConditionList = eventTrigger_Game2.StateConditionList;
                NrTSingleton <NrDebugConsole> .Instance.Print("EventTrigger Name - {0} (Unique:{1})", new object[]
                        {
                            eventTrigger_Game2.gameObject.name,
                            eventTrigger_Game2.EventTriggerUnique
                        });

                NrTSingleton <NrDebugConsole> .Instance.Print("\nEventCondition");

                NrTSingleton <NrDebugConsole> .Instance.Print("======================================");

                foreach (GameObject current in eventConditionList)
                {
                    EventTriggerItem_EventCondition component = current.GetComponent <EventTriggerItem_EventCondition>();
                    if (!(component == null))
                    {
                        NrTSingleton <NrDebugConsole> .Instance.Print("{0} - State : {1}", new object[]
                                {
                                    component.name,
                                    component.Verify
                                });
                    }
                }
                NrTSingleton <NrDebugConsole> .Instance.Print("Event : {0}", new object[]
                        {
                            eventTrigger_Game2.IsVerifyEvent()
                        });

                NrTSingleton <NrDebugConsole> .Instance.Print("======================================");

                NrTSingleton <NrDebugConsole> .Instance.Print("\nStateCondition");

                NrTSingleton <NrDebugConsole> .Instance.Print("======================================");

                foreach (GameObject current2 in stateConditionList)
                {
                    EventTriggerItem_StateCondition[] components = current2.GetComponents <EventTriggerItem_StateCondition>();
                    if (components != null)
                    {
                        EventTriggerItem_StateCondition[] array4 = components;
                        for (int m = 0; m < array4.Length; m++)
                        {
                            EventTriggerItem_StateCondition eventTriggerItem_StateCondition = array4[m];
                            NrTSingleton <NrDebugConsole> .Instance.Print("{0} - State : {1}", new object[]
                                    {
                                        eventTriggerItem_StateCondition.name,
                                        eventTriggerItem_StateCondition.Verify()
                                    });
                        }
                    }
                }
                NrTSingleton <NrDebugConsole> .Instance.Print("State : {0}", new object[]
                        {
                            eventTrigger_Game2.IsVerifyState()
                        });

                NrTSingleton <NrDebugConsole> .Instance.Print("======================================");

                goto IL_1E8D;
            }
            }
            NrTSingleton <NrDebugConsole> .Instance.Print("don't show anything.");

IL_1E8D:
            return;
        }
        }
        NrTSingleton <NrDebugConsole> .Instance.Print("sorry, can not interpret command.");
    }
Пример #9
0
        /// <summary>
        /// Calculate the gradients between the target m_loss and actual p_loss.
        /// </summary>
        /// <param name="sender">Specifies the sender.</param>
        /// <param name="e">Specifies the arguments.</param>
        private void m_memLoss_ComputeTdLoss(object sender, MemoryLossLayerGetLossArgs <T> e)
        {
            MemoryCollection rgMem = m_rgSamples;

            Blob <T> q_values      = m_netOutput.blob_by_name("logits");
            Blob <T> next_q_values = m_netTarget.blob_by_name("logits");

            float[] rgActions = rgMem.GetActionsAsOneHotVector(m_nActionCount);
            m_blobActions.ReshapeLike(q_values);
            m_blobActions.mutable_cpu_data = Utility.ConvertVec <T>(rgActions);
            m_blobQValue.ReshapeLike(q_values);

            // q_value = q_values.gather(1, action.unsqueeze(1)).squeeze(1)
            m_mycaffe.Cuda.mul(m_blobActions.count(), m_blobActions.gpu_data, q_values.gpu_data, m_blobQValue.mutable_gpu_data);
            reduce_sum_axis1(m_blobQValue);

            // next_q_value = next_q_values.max(1)[0]
            m_blobNextQValue.CopyFrom(next_q_values, false, true);
            reduce_argmax_axis1(m_blobNextQValue);

            // expected_q_values
            float[] rgRewards = rgMem.GetRewards();
            m_blobExpectedQValue.ReshapeLike(m_blobQValue);
            m_blobExpectedQValue.mutable_cpu_data = Utility.ConvertVec <T>(rgRewards);

            float[] rgDone = rgMem.GetInvertedDoneAsOneHotVector();
            m_blobDone.ReshapeLike(m_blobQValue);
            m_blobDone.mutable_cpu_data = Utility.ConvertVec <T>(rgDone);

            m_mycaffe.Cuda.mul(m_blobNextQValue.count(), m_blobNextQValue.gpu_data, m_blobDone.gpu_data, m_blobExpectedQValue.mutable_gpu_diff);           // next_q_val * (1- done)
            m_mycaffe.Cuda.mul_scalar(m_blobExpectedQValue.count(), m_fGamma, m_blobExpectedQValue.mutable_gpu_diff);                                      // gamma *  ^
            m_mycaffe.Cuda.add(m_blobExpectedQValue.count(), m_blobExpectedQValue.gpu_diff, m_blobExpectedQValue.gpu_data, m_blobExpectedQValue.gpu_data); // reward + ^

            // loss = (q_value - expected_q_value.detach()).pow(2)
            m_blobLoss.ReshapeLike(m_blobQValue);
            m_mycaffe.Cuda.sub(m_blobQValue.count(), m_blobQValue.gpu_data, m_blobExpectedQValue.gpu_data, m_blobQValue.mutable_gpu_diff); // q_value - expected_q_value
            m_mycaffe.Cuda.powx(m_blobLoss.count(), m_blobQValue.gpu_diff, 2.0, m_blobLoss.mutable_gpu_data);                              // (q_value - expected_q_value)^2

            // loss = (q_value - expected_q_value.detach()).pow(2) * weights
            m_blobWeights.ReshapeLike(m_blobQValue);
            m_blobWeights.mutable_cpu_data = Utility.ConvertVec <T>(m_rgSamples.Priorities);                                  // weights
            m_mycaffe.Cuda.mul(m_blobLoss.count(), m_blobLoss.gpu_data, m_blobWeights.gpu_data, m_blobLoss.mutable_gpu_data); //    ^ * weights

            // prios = loss + 1e-5
            m_mycaffe.Cuda.copy(m_blobLoss.count(), m_blobLoss.gpu_data, m_blobLoss.mutable_gpu_diff);
            m_mycaffe.Cuda.add_scalar(m_blobLoss.count(), 1e-5, m_blobLoss.mutable_gpu_diff);
            double[] rgPrios = Utility.ConvertVec <T>(m_blobLoss.mutable_cpu_diff);

            for (int i = 0; i < rgPrios.Length; i++)
            {
                m_rgSamples.Priorities[i] = rgPrios[i];
            }


            //-------------------------------------------------------
            //  Calculate the gradient - unroll the operations
            //  (autograd - psha! how about manualgrad :-D)
            //-------------------------------------------------------

            // initial gradient
            double dfGradient = 1.0;

            if (m_memLoss.layer_param.loss_weight.Count > 0)
            {
                dfGradient *= m_memLoss.layer_param.loss_weight[0];
            }

            // mean gradient - expand and divide by batch count
            dfGradient /= m_blobLoss.count();
            m_blobLoss.SetDiff(dfGradient);

            // multiplication gradient - multiply by the other side.
            m_mycaffe.Cuda.mul(m_blobLoss.count(), m_blobLoss.gpu_diff, m_blobWeights.gpu_data, m_blobLoss.mutable_gpu_diff);

            // power gradient - multiply by the exponent.
            m_mycaffe.Cuda.mul_scalar(m_blobLoss.count(), 2.0, m_blobLoss.mutable_gpu_diff);

            // q_value - expected_q_value gradient
            m_mycaffe.Cuda.mul(m_blobLoss.count(), m_blobLoss.gpu_diff, m_blobQValue.gpu_diff, m_blobLoss.mutable_gpu_diff);

            // squeeze/gather gradient
            mul(m_blobLoss, m_blobActions, e.Bottom[0]);

            e.Loss             = reduce_mean(m_blobLoss, false);
            e.EnableLossUpdate = false;
        }
Пример #10
0
        /// <summary>
        /// The Run method provides the main loop that performs the following steps:
        /// 1.) get state
        /// 2.) build experience
        /// 3.) create policy gradients
        /// 4.) train on experiences
        /// </summary>
        /// <param name="phase">Specifies the phae.</param>
        /// <param name="nN">Specifies the number of iterations (based on the ITERATION_TYPE) to run, or -1 to ignore.</param>
        /// <param name="type">Specifies the iteration type (default = ITERATION).</param>
        /// <param name="step">Specifies the training step to take, if any.  This is only used when debugging.</param>
        public void Run(Phase phase, int nN, ITERATOR_TYPE type, TRAIN_STEP step)
        {
            IMemoryCollection iMemory = MemoryCollectionFactory.CreateMemory(m_memType, m_nMemorySize, m_fPriorityAlpha);
            int    nIteration         = 1;
            double dfRunningReward    = 0;
            double dfEpisodeReward    = 0;
            int    nEpisode           = 0;
            bool   bDifferent         = false;

            StateBase state = getData(phase, -1, -1);
            // Preprocess the observation.
            SimpleDatum x = m_brain.Preprocess(state, m_bUseRawInput, out bDifferent, true);

            // Set the initial target model to the current model.
            m_brain.UpdateTargetModel();

            while (!m_brain.Cancel.WaitOne(0) && !isAtIteration(nN, type, nIteration, nEpisode))
            {
                // Forward the policy network and sample an action.
                int action = m_brain.act(x, state.Clip, state.ActionCount);

                // Take the next step using the action
                StateBase state_next = getData(phase, action, nIteration);

                // Preprocess the next observation.
                SimpleDatum x_next = m_brain.Preprocess(state_next, m_bUseRawInput, out bDifferent);
                if (!bDifferent)
                {
                    m_brain.Log.WriteLine("WARNING: The current state is the same as the previous state!");
                }

                // Build up episode memory, using reward for taking the action.
                iMemory.Add(new MemoryItem(state, x, action, state_next, x_next, state_next.Reward, state_next.Done, nIteration, nEpisode));
                dfEpisodeReward += state_next.Reward;

                // Do the training
                if (iMemory.Count > m_brain.BatchSize)
                {
                    double           dfBeta    = beta_by_frame(nIteration);
                    MemoryCollection rgSamples = iMemory.GetSamples(m_random, m_brain.BatchSize, dfBeta);
                    m_brain.Train(nIteration, rgSamples, state.ActionCount);
                    iMemory.Update(rgSamples);

                    if (nIteration % m_nUpdateTargetFreq == 0)
                    {
                        m_brain.UpdateTargetModel();
                    }
                }

                if (state_next.Done)
                {
                    // Update reward running
                    dfRunningReward = dfRunningReward * 0.99 + dfEpisodeReward * 0.01;

                    nEpisode++;
                    updateStatus(nIteration, nEpisode, dfEpisodeReward, dfRunningReward, 0, 0, m_brain.GetModelUpdated());

                    state           = getData(phase, -1, -1);
                    x               = m_brain.Preprocess(state, m_bUseRawInput, out bDifferent, true);
                    dfEpisodeReward = 0;
                }
                else
                {
                    state = state_next;
                    x     = x_next;
                }

                nIteration++;
            }

            iMemory.CleanUp();
        }
Пример #11
0
    public override void Update()
    {
        NrTSingleton <NrUpdateProcessor> .Instance.MainUpdate();

        if (NkInputManager.GetKeyDown(KeyCode.Escape))
        {
            this.m_ResolutionWindow = !this.m_ResolutionWindow;
        }
        if (!TsPlatform.IsEditor || NkInputManager.GetKeyUp(KeyCode.Alpha3))
        {
        }
        if (NkInputManager.GetKey(KeyCode.LeftShift) && NkInputManager.GetKeyUp(KeyCode.Alpha3))
        {
            TsLog.LogError("GetMonoHeapSize = {0},  GetMonoUsedSize = {1} , usedHeapSize = {2} ", new object[]
            {
                Profiler.GetMonoHeapSize(),
                Profiler.GetMonoUsedSize(),
                Profiler.usedHeapSize
            });
            MemoryCollection.Print(MemoryCollection.Mode.LoadedAll);
        }
        if (NkInputManager.GetKey(KeyCode.LeftShift) && NkInputManager.GetKeyUp(KeyCode.Alpha2))
        {
            NrTSingleton <NrMainSystem> .Instance.CleanUpImmediate();
        }
        if (NkInputManager.GetKey(KeyCode.LeftShift) && NkInputManager.GetKeyUp(KeyCode.Alpha4))
        {
            NrTSingleton <FormsManager> .Instance.DeleteAll();
        }
        if (!TsPlatform.IsEditor || !NkInputManager.GetKey(KeyCode.LeftShift) || NkInputManager.GetKeyUp(KeyCode.Alpha0))
        {
        }
        if (NkInputManager.GetKey(KeyCode.LeftShift) && NkInputManager.GetKeyUp(KeyCode.Alpha5))
        {
            TsPlatform.FileLog("AppMemory : " + NrTSingleton <NrMainSystem> .Instance.AppMemory);
        }
        if (TsPlatform.IsMobile && !TsPlatform.IsEditor && Input.GetKeyUp(KeyCode.Escape))
        {
            string   text     = "FromESC";
            MsgBoxUI msgBoxUI = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.MSGBOX_DLG) as MsgBoxUI;

            if (msgBoxUI != null)
            {
                string b = msgBoxUI.GetYesObject() as string;
                if (text != null && text == b && this.IsBattleStop())
                {
                    Battle_Control_Dlg battle_Control_Dlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.BATTLE_CONTROL_DLG) as Battle_Control_Dlg;

                    if (battle_Control_Dlg != null)
                    {
                        battle_Control_Dlg.bESC = false;
                    }
                    this.BattleStopStart(false);
                }
            }
            bool flag = NrTSingleton <FormsManager> .Instance.CloseFormESC();

            if (NrTSingleton <FormsManager> .Instance.IsForm(G_ID.ITEMMALL_POPUPSHOP_DLG))
            {
                return;
            }
            if (NrTSingleton <FormsManager> .Instance.IsForm(G_ID.TOASTMSG_DLG))
            {
                MsgBoxUI msgBoxUI2 = NrTSingleton <FormsManager> .Instance.LoadForm(G_ID.MSGBOX_DLG) as MsgBoxUI;

                if (msgBoxUI2 != null)
                {
                    this.BattleStopStart(false);
                    if (Battle.BATTLE != null && !NrTSingleton <ContentsLimitManager> .Instance.IsBattleStopLimit())
                    {
                        Battle_Control_Dlg battle_Control_Dlg2 = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.BATTLE_CONTROL_DLG) as Battle_Control_Dlg;

                        if (battle_Control_Dlg2 != null)
                        {
                            battle_Control_Dlg2.ShowRetreatWithCancel();
                        }
                    }
                    else
                    {
                        msgBoxUI2.SetMsg(new YesDelegate(this.EscQuitGame), null, NrTSingleton <NrTextMgr> .Instance.GetTextFromPreloadText("7"), NrTSingleton <NrTextMgr> .Instance.GetTextFromPreloadText("38"), eMsgType.MB_OK_CANCEL, 2);
                    }
                }
            }
            else if (!flag && Scene.CurScene != Scene.Type.SELECTCHAR)
            {
                MsgBoxUI msgBoxUI3 = NrTSingleton <FormsManager> .Instance.LoadForm(G_ID.MSGBOX_DLG) as MsgBoxUI;

                if (msgBoxUI3 != null)
                {
                    this.BattleStopStart(true);
                    if (Battle.BATTLE != null && !NrTSingleton <ContentsLimitManager> .Instance.IsBattleStopLimit())
                    {
                        Battle_Control_Dlg battle_Control_Dlg3 = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.BATTLE_CONTROL_DLG) as Battle_Control_Dlg;

                        if (battle_Control_Dlg3 != null)
                        {
                            battle_Control_Dlg3.ShowRetreatWithCancel();
                        }
                    }
                    else
                    {
                        msgBoxUI3.SetMsg(new YesDelegate(this.EscQuitGame), null, NrTSingleton <NrTextMgr> .Instance.GetTextFromPreloadText("7"), NrTSingleton <NrTextMgr> .Instance.GetTextFromPreloadText("38"), eMsgType.MB_OK_CANCEL, 2);
                    }
                }
                NrTSingleton <FiveRocksEventManager> .Instance.Placement("backbutton_click");
            }
        }
        if (NkInputManager.GetKeyDown(KeyCode.Alpha1) && NkInputManager.GetKey(KeyCode.RightShift))
        {
            this.m_bSwitchMyCharInfoGUI = !this.m_bSwitchMyCharInfoGUI;
        }
    }