protected override bool ExecCommand(StoryInstance instance, StoryValueParam <string> _params, long delta) { string val = _params.Param1Value; if (Network.NetworkSystem.Instance.CanSendMessage) { Msg_CR_GmCommand cmdMsg = new Msg_CR_GmCommand(); cmdMsg.type = 0; Network.NetworkSystem.Instance.SendMessage(RoomMessageDefine.Msg_CR_GmCommand, cmdMsg); } return(false); }
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.GetActiveScene(); if (scene != null) { scene.GmStorySystem.Reset(); if (scene.GmStorySystem.GlobalVariables.ContainsKey("UserInfo")) { scene.GmStorySystem.GlobalVariables["UserInfo"] = user.Info; } else { scene.GmStorySystem.GlobalVariables.Add("UserInfo", user.Info); } switch (cmdMsg.type) { case 0: //resetdsl StorySystem.StoryConfigManager.Instance.Clear(); scene.StorySystem.ClearStoryInstancePool(); for (int i = 1; i < 10; ++i) { scene.StorySystem.PreloadStoryInstance(i); } scene.StorySystem.StartStory(1); break; case 1: //script if (null != cmdMsg.content) { scene.GmStorySystem.LoadStory(cmdMsg.content); scene.GmStorySystem.StartStory(1); } break; case 2: //command #if DEBUG if (null != cmdMsg.content) { scene.GmStorySystem.LoadStoryText("script(1){onmessage(\"start\"){" + cmdMsg.content + "}}"); scene.GmStorySystem.StartStory(1); } #else LogSys.Log(LOG_TYPE.ERROR, "GM command can't used in RELEASE !"); #endif break; } } }
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; } } }
public 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.OwnRoomUserManager.ActiveScene; if (scene != null) { switch (cmdMsg.type) { case 0: //resetdsl scene.GmStorySystem.Reset(); if (scene.GmStorySystem.GlobalVariables.ContainsKey("EntityInfo")) { scene.GmStorySystem.GlobalVariables["EntityInfo"] = BoxedValue.From(user.Info); } else { scene.GmStorySystem.GlobalVariables.Add("EntityInfo", BoxedValue.From(user.Info)); } StorySystem.StoryConfigManager.Instance.Clear(); scene.StorySystem.ClearStoryInstancePool(); scene.StorySystem.LoadSceneStories(); 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"] = BoxedValue.From(user.Info); } else { scene.GmStorySystem.GlobalVariables.Add("EntityInfo", BoxedValue.From(user.Info)); } scene.GmStorySystem.LoadStory(cmdMsg.content); scene.GmStorySystem.StartStory("main"); } break; case 2: //command if (null != cmdMsg.content) { string cmd = cmdMsg.content; scene.GmStorySystem.Reset(); if (scene.GmStorySystem.GlobalVariables.ContainsKey("EntityInfo")) { scene.GmStorySystem.GlobalVariables["EntityInfo"] = BoxedValue.From(user.Info); } else { scene.GmStorySystem.GlobalVariables.Add("EntityInfo", BoxedValue.From(user.Info)); } scene.GmStorySystem.LoadStoryText(System.Text.Encoding.UTF8.GetBytes("script(main){onmessage(\"start\"){" + cmd + "}}")); scene.GmStorySystem.StartStory("main"); } break; } } }