GameFramework.Msg_CR_GmCommandHandler.Execute C# (CSharp) Method

Execute() static private method

static private Execute ( object msg, User user ) : void
msg object
user User
return void
        internal static void Execute(object msg, User user)
        {
            Msg_CR_GmCommand cmdMsg = msg as Msg_CR_GmCommand;
            if (cmdMsg == null) {
                return;
            }
            if (!GlobalVariables.Instance.IsDebug)
                return;
            Scene scene = user.OwnRoom.ActiveScene;
            if (scene != null) {
                switch (cmdMsg.type) {
                    case 0:
                        //resetdsl
                        scene.GmStorySystem.Reset();
                        if (scene.GmStorySystem.GlobalVariables.ContainsKey("EntityInfo")) {
                            scene.GmStorySystem.GlobalVariables["EntityInfo"] = user.Info;
                        } else {
                            scene.GmStorySystem.GlobalVariables.Add("EntityInfo", user.Info);
                        }
                        StorySystem.StoryConfigManager.Instance.Clear();
                        scene.StorySystem.ClearStoryInstancePool();
                        scene.StorySystem.PreloadSceneStories();
                        scene.StorySystem.StartStory("local_main");
                        scene.StorySystem.StartStory("story_main");
                        break;
                    case 1:
                        //script
                        if (null != cmdMsg.content) {
                            scene.GmStorySystem.Reset();
                            if (scene.GmStorySystem.GlobalVariables.ContainsKey("EntityInfo")) {
                                scene.GmStorySystem.GlobalVariables["EntityInfo"] = user.Info;
                            } else {
                                scene.GmStorySystem.GlobalVariables.Add("EntityInfo", user.Info);
                            }
                            scene.GmStorySystem.LoadStory(cmdMsg.content);
                            scene.GmStorySystem.StartStory("main");
                        }
                        break;
                    case 2:
                        //command
                        if (null != cmdMsg.content) {
                            string cmd = cmdMsg.content;
                            int stIndex = cmd.IndexOf('(');
                            if (stIndex > 0) {
            #if DEBUG
                                scene.GmStorySystem.Reset();
                                if (scene.GmStorySystem.GlobalVariables.ContainsKey("EntityInfo")) {
                                    scene.GmStorySystem.GlobalVariables["EntityInfo"] = user.Info;
                                } else {
                                    scene.GmStorySystem.GlobalVariables.Add("EntityInfo", user.Info);
                                }
                                scene.GmStorySystem.LoadStoryText("script(main){onmessage(\"start\"){" + cmd + "}}");
                                scene.GmStorySystem.StartStory("main");
            #else
                if (scene.GmStorySystem.GlobalVariables.ContainsKey("EntityInfo")) {
                  scene.GmStorySystem.GlobalVariables["EntityInfo"] = user.Info;
                } else {
                  scene.GmStorySystem.GlobalVariables.Add("EntityInfo", user.Info);
                }
                int edIndex = cmd.IndexOf(')');
                if (edIndex > 0) {
                  string msgId = cmd.Substring(0, stIndex);
                  string[] args = cmd.Substring(stIndex + 1, edIndex - stIndex).Split(',');
                  scene.GmStorySystem.SendMessage(msgId, args);
                }
            #endif
                            } else {
                                if (scene.GmStorySystem.GlobalVariables.ContainsKey("EntityInfo")) {
                                    scene.GmStorySystem.GlobalVariables["EntityInfo"] = user.Info;
                                } else {
                                    scene.GmStorySystem.GlobalVariables.Add("EntityInfo", user.Info);
                                }
                                stIndex = cmd.IndexOf(' ');
                                if (stIndex > 0) {
                                    string msgId = cmd.Substring(0, stIndex);
                                    string[] args = cmd.Substring(stIndex + 1).Split(new char[] { ' ' }, System.StringSplitOptions.RemoveEmptyEntries);
                                    scene.GmStorySystem.SendMessage(msgId, args);
                                } else {
                                    scene.GmStorySystem.SendMessage(cmd);
                                }
                            }
                        }
                        break;
                }
            }
        }
Msg_CR_GmCommandHandler