Ejemplo n.º 1
0
        //剧情脚本模板加载回调
        private void ScriptTemplateLoaded(TextAsset textObj)
        {
            if (null == textObj)
            {
                return;
            }

            string triggerName = "triggerTable>0>trigger";

            XMLNode rootNode = XMLParser.Parse(textObj.ToString());

            foreach (XMLNode triggerNode in rootNode.GetNodeList(triggerName))
            {
                string scriptName = triggerNode.GetValue("@scriptName");
                string type       = triggerNode.GetValue("@type");

                ScriptBaseEntry baseEntry = StoryFactory.GetEntry(type);
                if (null != baseEntry)
                {
                    baseEntry.ScriptName = scriptName;
                    baseEntry.ParseNode(triggerNode);
                    scriptEntryList.Add(baseEntry);
                }
            }
        }
Ejemplo n.º 2
0
        //播放玩家升级后剧情
        public bool PlayLevelUpStory(ClosedCallback callBack)
        {
            bool result = false;

            closedCallback = callBack;

            ScriptLevelUpEntry entry = StoryFactory.GetEntry(StoryConst.TRIG_LEVEL_UP) as ScriptLevelUpEntry;

            result = Singleton <StoryMode> .Instance.StoryExits(entry);

            if (result)
            {
                Singleton <StoryMode> .Instance.LoadActionData(entry, LoadDataCallback);
            }

            return(result);
        }
Ejemplo n.º 3
0
        //播放出场景剧情
        public bool PlayExitSceneStory(uint mapId, ClosedCallback callBack)
        {
            bool result = false;

            closedCallback = callBack;

            ScriptExitSceneEntry entry = StoryFactory.GetEntry(StoryConst.TRIG_EXIT_SCENE) as ScriptExitSceneEntry;

            entry.SceneId = mapId.ToString();
            result        = Singleton <StoryMode> .Instance.StoryExits(entry);

            if (result)
            {
                Singleton <StoryMode> .Instance.LoadActionData(entry, LoadDataCallback);
            }

            return(result);
        }
Ejemplo n.º 4
0
        //播放完成任务后剧情
        public bool PlayFinishTaskStory(uint taskId, ClosedCallback callBack)
        {
            bool result = false;

            closedCallback = callBack;

            ScriptFinishTaskEntry entry = StoryFactory.GetEntry(StoryConst.TRIG_TASK_FINISHED) as ScriptFinishTaskEntry;

            entry.TaskId = taskId.ToString();
            result       = Singleton <StoryMode> .Instance.StoryExits(entry);

            if (result)
            {
                Singleton <StoryMode> .Instance.LoadActionData(entry, LoadDataCallback);
            }

            return(result);
        }
Ejemplo n.º 5
0
        //播放主角走到某区域剧情
        public bool PlayHeroArriveStory(uint mapId, Vector3 pos, ClosedCallback callBack)
        {
            bool result = false;

            closedCallback = callBack;

            ScriptHeroArriveAreaEntry entry = StoryFactory.GetEntry(StoryConst.TRIG_HERO_ARRIVE_AREA) as ScriptHeroArriveAreaEntry;

            entry.SceneId  = mapId.ToString();
            entry.Position = pos;
            result         = Singleton <StoryMode> .Instance.StoryExits(entry);

            if (result)
            {
                Singleton <StoryMode> .Instance.LoadActionData(entry, LoadDataCallback);
            }

            return(result);
        }
Ejemplo n.º 6
0
        //播放怪物HP更改剧情
        public bool PlayMonsterHpChangeStory(string monsterId, ClosedCallback callBack)
        {
            bool result = false;

            closedCallback = callBack;

            ScriptHpChangeEntry entry = StoryFactory.GetEntry(StoryConst.TRIG_HP_CHANGE) as ScriptHpChangeEntry;

            entry.RoleType = StoryConst.MONSTER;
            entry.Id       = monsterId;
            result         = Singleton <StoryMode> .Instance.StoryExits(entry);

            if (result)
            {
                Singleton <StoryMode> .Instance.LoadActionData(entry, LoadDataCallback);
            }

            return(result);
        }
Ejemplo n.º 7
0
        //播放主角HP更改剧情
        public bool PlayHeroHpChangeStory(ClosedCallback callBack)
        {
            bool result = false;

            closedCallback = callBack;

            ScriptHpChangeEntry entry = StoryFactory.GetEntry(StoryConst.TRIG_HP_CHANGE) as ScriptHpChangeEntry;

            entry.RoleType = string.Empty;
            entry.Id       = StoryConst.SELF_ID;
            result         = Singleton <StoryMode> .Instance.StoryExits(entry);

            if (result)
            {
                Singleton <StoryMode> .Instance.LoadActionData(entry, LoadDataCallback);
            }

            return(result);
        }
Ejemplo n.º 8
0
        //播放阶段战斗剧情
        public bool PlayFightStageStory(uint mapId, uint stageId, uint monsterId, ClosedCallback callBack)
        {
            bool result = false;

            closedCallback = callBack;

            ScriptFightStageEntry entry = StoryFactory.GetEntry(StoryConst.TRIG_FIGHT_STAGE) as ScriptFightStageEntry;

            entry.SceneId   = mapId.ToString();
            entry.StageId   = stageId.ToString();
            entry.MonsterId = monsterId.ToString();
            result          = Singleton <StoryMode> .Instance.StoryExits(entry);

            if (result)
            {
                Singleton <StoryMode> .Instance.LoadActionData(entry, LoadDataCallback);
            }

            return(result);
        }