Beispiel #1
0
        public void setData(int iStageId)
        {
            iStageID = iStageId;

            mConsumePower.text = "0";
            mRewardGold.text   = "0";
            mRewardExp.text    = "0";

            //StageTemplate stageinfo = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(iStageID);
            StageTemplate stageinfo = StageModule.GetStageTemplateById(iStageID);
            //if (list.ContainsKey(iStageId))
            {
                //StageTemplate stageinfo = (StageTemplate)list[iStageID];
                if (stageinfo != null)
                {
                    mStageDescription.text = GameUtils.getString(stageinfo.m_stageinfo);
                    mConsumePower.text     = stageinfo.m_cost.ToString();
                    mRewardGold.text       = stageinfo.m_goldreward.ToString();
                    mRewardExp.text        = stageinfo.m_heroexp.ToString();
                    if (expMoney != null)
                    {
                        if (stageinfo.m_expcrystal == -1)
                        {
                            expMoney.SetActive(false);
                        }
                        else
                        {
                            expMoney.SetActive(true);
                            mRewarExpMoney.text = stageinfo.m_expcrystal.ToString();
                        }
                    }
                }
            }
        }
Beispiel #2
0
    public static EM_STAGE_STAGETYPE GetStageStageType(StageTemplate stageT)
    {
        EM_STAGE_STAGETYPE type = EM_STAGE_STAGETYPE.MAIN;

        switch (GetStageType(stageT))
        {
        case EM_STAGE_TYPE.LIMIT_TEST:
            return(EM_STAGE_STAGETYPE.LITMIT_TIMES);

        case EM_STAGE_TYPE.MAIN_QUEST1:
        case EM_STAGE_TYPE.MAIN_QUEST2:
        case EM_STAGE_TYPE.MAIN_QUEST3:
            return(EM_STAGE_STAGETYPE.MAIN);

        case EM_STAGE_TYPE.SIDE_QUEST:
            return(EM_STAGE_STAGETYPE.SIDE);

        case EM_STAGE_TYPE.SPEC_QUEST:
            return(EM_STAGE_STAGETYPE.SPECIAL);

        case EM_STAGE_TYPE.ACTIVE_QUEST_DIJING:
        case EM_STAGE_TYPE.ACTIVE_QUEST_YANLONG:
            return(EM_STAGE_STAGETYPE.ACTIVE);

        case EM_STAGE_TYPE.BOSS_SHOUWANGZHE:
        case EM_STAGE_TYPE.BOSS_CHUANSHUO:
            return(EM_STAGE_STAGETYPE.BOSS);

        default:
            return(EM_STAGE_STAGETYPE.NONE);
        }
    }
        private void LoadAssetbundle()
        {
            int CurStageID = 0;

            if (ObjectSelf.GetInstance().GetIsPrompt())
            {
                CurStageID = ObjectSelf.GetInstance().GetPromptCurCampaignID();
            }
            else
            {
                CurStageID = ObjectSelf.GetInstance().GetCurCampaignID();
            }
            CurStage = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(CurStageID);
            FightControler.isOpeningAnimation = CurStage.m_iskcdh != -1;

            if (CurStage.m_stageevent[0] != "-1")
            {
                Monstersdata = new MonsterGroupDataObjMgr(AssetLoader.Inst.GetEditorAssetRes(CurStage.m_stageevent[0]) as MonsterGroupDataObj);
            }
            if (CurStage.m_stageevent[1] != "-1")
            {
                HeroPathdata = AssetLoader.Inst.GetEditorAssetRes(CurStage.m_stageevent[1]) as HeroPathDataObj;
                //测试用的;
                HeroPathdata.MoveDistance -= 4f;
            }
            if (CurStage.m_stageevent[2] != "-1")
            {
                Camdata = AssetLoader.Inst.GetEditorAssetRes(CurStage.m_stageevent[2]) as CameraDataObj;
            }
            if (CurStage.m_stageevent[3] != "-1")
            {
                StoryAnimdata = AssetLoader.Inst.GetEditorAssetRes(CurStage.m_stageevent[3]) as StoryAnimDataObj;
            }
            LoadFightEditor();
        }
Beispiel #4
0
    private string GetBossName(StageTemplate stageData)
    {
        MonstergroupTemplate _monsterGroup = null;
        MonsterTemplate      _bossTemp     = null;

        for (int i = stageData.m_monstergroup.Length - 1; i >= 0; i--)
        {
            _monsterGroup = null;
            _bossTemp     = null;
            if (stageData.m_monstergroup[i] <= 0)
            {
                continue;
            }
            _monsterGroup = DataTemplate.GetInstance().m_MonsterGroupTable.getTableData(stageData.m_monstergroup[i]) as MonstergroupTemplate;
            if (_monsterGroup == null || _monsterGroup.getGrouptype() != 2 || GameUtils.GetObjectClassById(_monsterGroup.getMonsterid()[0]) != EM_OBJECT_CLASS.EM_OBJECT_CLASS_MONSTER)
            {
                continue;
            }

            _bossTemp = DataTemplate.GetInstance().m_MonsterTable.getTableData(_monsterGroup.getMonsterid()[0]) as MonsterTemplate;
            if (_bossTemp != null)
            {
                break;
            }
        }
        if (_bossTemp == null)
        {
            return(null);
        }
        else
        {
            return(GameUtils.getString(_bossTemp.getMonstername()));
        }
    }
Beispiel #5
0
    private void RapidClearRespondHandler(GameEvent e)
    {
        if (e.data == null)
        {
            //Debug.Log("奖励物品数量:"+((List<BattelInfo>)e.data).Count);
            return;
        }
        UI_BattleendPanel temp = null;

        if (UI_BattleendPanel._inist == null)
        {
            GameObject go = UI_HomeControler.Inst.AddUI(UI_BattleendPanel.UI_Res);
            if (temp == null)
            {
                temp = go.AddComponent <UI_BattleendPanel>();
            }
            else
            {
                temp = go.GetComponent <UI_BattleendPanel>();
            }
        }
        else
        {
            temp = UI_BattleendPanel._inist;
        }
        //关卡表目前是写死的;
        StageTemplate stageinfo = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(ObjectSelf.GetInstance().CurStageID);

        temp.SetSweepCostResourceType(1400010001, stageinfo.m_cost);
        temp.setType(UI_BattleendPanel.PanelType.Clear);
        temp.ClearUpdate((List <BattelInfo>)e.data);
        temp.enabled = true;
    }
Beispiel #6
0
        public void IsShowSealBox()
        {
            StageTemplate stageDate = null;

            if (ObjectSelf.GetInstance().GetIsPrompt())
            {
                stageDate = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(ObjectSelf.GetInstance().GetPromptCurCampaignID());
            }
            else
            {
                stageDate = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(ObjectSelf.GetInstance().GetCurCampaignID());
            }
            //if (stageDate.m_bossbox != -1)
            {
                if (ObjectSelf.GetInstance().GetIsOpenSealBox())
                {
                    AddUI("UI_Fight/UI_SealBox_1_1");
                    StopCoroutine(showFightEnd(isWin));
                }
                else
                {
                    if (ObjectSelf.GetInstance().LimitFightMgr.m_bStartEnter == false)
                    {
                        ShowCombat(isWin);
                    }
                }
            }
        }
Beispiel #7
0
    public static void PropsacessHandler(int type, int data)
    {
        switch (type)
        {
        case 1:                 //副本;
            UI_HomeControler.Inst.RemoveAllUIButThis(new string[] { UI_MainHome.UI_ResPath });

            UI_SelectLevelMgrNew.InitLevelId = data;
            UI_HomeControler.Inst.AddUI(UI_SelectLevelMgrNew.UI_ResPath);
            UI_HomeControler.Inst.AddUI(UI_Stage.UI_Res);
            StageTemplate stageT = StageModule.GetStageTemplateById(data);
            UI_Stage.Inst.Show(stageT);
            break;

        case 2:                 //66表--界面跳转表id;
            PropsjumpuiTemplate jumpUiT = DataTemplate.GetInstance().m_PropsacessTable.getTableData(data) as PropsjumpuiTemplate;
            if (jumpUiT != null)
            {
                UI_HomeControler.Inst.AddUI(jumpUiT.getJumpUIpath());
            }
            break;

        default:
            LogManager.LogError("不支持的获得途径类型" + type);
            break;
        }
    }
Beispiel #8
0
    //protected override void OnClickWorldMap()
    //{
    //    UI_HomeControler.Inst.AddUI(UI_WordMap.UI_ResPath);
    //    UI_HomeControler.Inst.ReMoveUI(UI_SelectLevelMgr.UI_ResPath);
    //    UI_WorldMapManage._instance.WorldMapShow();
    //}

    /// <summary>
    /// 判断当前章节,某个难度的关卡是否通关;
    /// </summary>
    /// <param name="chapterId"></param>
    /// <param name="type"></param>
    /// <returns></returns>
    bool CheckPrevStageIsPass(int chapterId, EM_STAGE_DIFFICULTTYPE type, out int prevStageId)
    {
        ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(chapterId);

        prevStageId = -1;

        if (chapterT != null)
        {
            int stageId = StageModule.GetFirstStageIdInTheChapter(chapterT, type);

            StageTemplate st = StageModule.GetStageTemplateById(stageId);

            prevStageId = st.m_premissionid;

            ///前置关卡为-1时,表示不需要前置关卡,直接开启;
            if (prevStageId == -1)
            {
                return(true);
            }

            int star = -1;
            if (ObjectSelf.GetInstance().BattleStageData.IsCopyScenePass(prevStageId, out star))
            {
                if (star > 0)
                {
                    return(true);
                }
            }
        }

        return(false);
    }
Beispiel #9
0
        public void onClick()
        {
            //if (isSelect) return;
            if (!isOpen)
            {
                if (mStageInfo.m_premissionid != -1)
                {
                    ObjectSelf.GetInstance().SetCurCampaignID(iStageID);
                    //StageTemplate newStage = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(mStageInfo.m_premissionid);
                    StageTemplate newStage = StageModule.GetStageTemplateById(mStageInfo.m_premissionid);
                    //需修改
                    if (ObjectSelf.GetInstance().GetIsPrompt())
                    {
                        UI_PromptFightArea.Inst.AddMsgBox(string.Format(GameUtils.getString("activitystage_tip1"), GameUtils.getString(newStage.m_stagename)));
                    }
                    else
                    {
                        string level = null;
                        switch (ObjectSelf.GetInstance().CurChapterLevel)
                        {
                        case 1:
                            level = GameUtils.getString("fight_stageselect_difficulty1");
                            break;

                        case 2:
                            level = GameUtils.getString("fight_stageselect_difficulty2");
                            break;

                        case 3:
                            level = GameUtils.getString("fight_stageselect_difficulty3");
                            break;

                        default:
                            break;
                        }

                        InterfaceControler.GetInst().AddMsgBox(string.Format(GameUtils.getString("fight_stageselect_tip3"), level, GameUtils.getString(newStage.m_stagename)));
                    }
                    //GameUtils.getString(newStage.m_stagename)
                }
            }
            else
            {
                ObjectSelf.GetInstance().SetCurCampaignID(iStageID);
                //if (UI_SelectFightArea.Inst != null)
                //{
                //    UI_SelectFightArea.Inst.onStageSelect(iStageID);
                //}
                //else
                {
                    UI_PromptFightArea.Inst.onStageSelect(iStageID);
                }
                if (mTag.activeSelf)
                {
                    mTag.SetActive(false);
                }
            }
        }
Beispiel #10
0
    public static bool IsStageLevelById(int stageLevelId)
    {
        StageTemplate stageT = GetStageTemplateById(stageLevelId);

        if (stageT != null)
        {
            return(stageT.m_stagetype == 1 || stageT.m_stagetype == 2 || stageT.m_stagetype == 3 || stageT.m_stagetype == 4);
        }

        return(false);
    }
Beispiel #11
0
    private GameObject mQualityHight; // 高画质
    public override void InitUIData()
    {
        LoadComponent();
        mInitSpeed = GameTimeControler.Inst.curTimeScaleState;
        GameTimeControler.Inst.SetState(TimeScaleState.TimeScale_Pause);
        mQualityLow   = selfTransform.FindChild("left/Quality/low").gameObject;
        mQualityHight = selfTransform.FindChild("left/Quality/hight").gameObject;
        setQualityView();

        m_StageTemp = GetCurrentStage();
    }
Beispiel #12
0
        public void EnterBattleScene(int nSceneID)
        {
            StageTemplate pRow = ( StageTemplate )DataTemplate.GetInstance().m_StageTable.getTableData(nSceneID);

            if (m_needLoadingTable.ContainsKey(pRow.m_stagemap) == false)
            {
                m_needLoadingTable.Add(pRow.m_stagemap, true);
            }

            StartChangeScene(pRow.m_stagemap);
        }
Beispiel #13
0
    private bool isEnoughPow(StageTemplate stageT)
    {
        int iPower = ObjectSelf.GetInstance().ActionPoint;

        if (iPower >= stageT.m_cost)
        {
            return(true);
        }

        return(false);
    }
Beispiel #14
0
    public override void OnDestroy()
    {
        GameEventDispatcher.Inst.removeEventListener(GameEventID.U_RapidClearRespond, RapidClearRespondHandler);
        GameEventDispatcher.Inst.removeEventListener(GameEventID.UI_StageDataRefresh, OnStageDataRefreshed);

        mStageT = null;
        mEnermyList.Clear();
        mEnermyList = null;
        mItemsList.Clear();
        mItemsList = null;

        mInst = null;
    }
        public void FightNumShow()
        {
            ChapterinfoTemplate levelInfo = (ChapterinfoTemplate)DataTemplate.GetInstance().m_ChapterTable.getTableData(1001);

            int[] levelID = levelInfo.getStageID();
            for (int i = 0; i < levelID.Length; i++)
            {
                if (levelID[i] == ObjectSelf.GetInstance().CurStageID)
                {
                    StageTemplate stage = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(levelID[i]);
                    mStageItemList[i].init(stage, i);
                }
            }
        }
Beispiel #16
0
    void OnLevelItemClick(int stageId)
    {
        //判断是否是神秘商店(不在关卡表中就是神秘商店),是的话打开神秘商店界面;
        if (StageModule.IsMysteriousShop(stageId))
        {
            UI_HomeControler.Inst.AddUI(UI_MysteriousShop.Path);

            return;
        }

        //判断当前关卡是否开启;
        if (ObjectSelf.GetInstance().BattleStageData.IsStageOpen(stageId))
        {
            CurLevelID = stageId;
        }
        else
        {
            string difStr = "";
            switch (mDifficutType)
            {
            case EM_STAGE_DIFFICULTTYPE.NONE:
                break;

            case EM_STAGE_DIFFICULTTYPE.NORMAL:
                difStr = GameUtils.getString("fight_stageselect_difficulty1");
                break;

            case EM_STAGE_DIFFICULTTYPE.HARD:
                difStr = GameUtils.getString("fight_stageselect_difficulty2");
                break;

            case EM_STAGE_DIFFICULTTYPE.HARDEST:
                difStr = GameUtils.getString("fight_stageselect_difficulty3");
                break;

            default:
                break;
            }

            string        preChapterName = "";
            StageTemplate stageT         = StageModule.GetStageTemplateById(stageId);
            if (stageT.m_premissionid != -1)
            {
                StageTemplate premStageT = StageModule.GetStageTemplateById(stageT.m_premissionid);
                preChapterName = GameUtils.getString(premStageT.m_stagename);
            }

            InterfaceControler.GetInst().AddMsgBox(string.Format(GameUtils.getString("fight_stageselect_tip3"), difStr, preChapterName));
        }
    }
Beispiel #17
0
    /// <summary>
    /// 通过关卡id获得该关卡所在的章节信息;
    /// </summary>
    /// 策划说关卡id在章节中是唯一的,一个关卡不可能出现在多个章节中,所以该方法有效;
    /// <param name="id"></param>
    /// <returns></returns>
    public int GetChapterIdByStageT(StageTemplate stageT)
    {
        if (stageT != null)
        {
            ChapterinfoTemplate chapterT = GetChapterTemplateByStageID(stageT.m_stageid);

            if (chapterT != null)
            {
                return(chapterT.getId());
            }
        }

        return(-1);
    }
Beispiel #18
0
        public override void InitUIView()
        {
            //入场自动战斗
            onModelCall();
            UIProcess();

            int id = FightControler.Inst.StageID;

            //mCurTime = FightControler.Inst.GetRemainingCountTime();
            if (mCurTime != -1)
            {
                isUpdateTime = true;
                //mInfiniteTime.SetActive(false);
            }
            else
            {
                isUpdateTime = false;
                setTime(999);
            }


            //是否极限试炼  初始化回合数
            if (ObjectSelf.GetInstance().LimitFightMgr.m_bStartEnter)
            {
                // mTotalRound.setMaxValue(DataTemplate.GetInstance().m_GameConfig.getUltimatetrial_max_wave());
                Debug.LogError("极限试炼 回合数代码逻辑要修改");
                ShowLimitFightRoundNum();
            }
            else
            {
                // 设置关卡名
                int             iStageId  = FightControler.Inst.StageID;
                StageTemplate   stageinfo = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(iStageId);
                ChsTextTemplate template  = (ChsTextTemplate)DataTemplate.GetInstance().m_ChsTextTable.getTableData(stageinfo.m_stagename);
                if (stageinfo != null /*&& strData.ContainsKey(stageinfo.m_stagename)*/)
                {
                    //ChsTextTemplate template = (ChsTextTemplate)strData[stageinfo.m_stagename];
                    mStageName.text = template.languageMap["Chinese"];
                }

                // mTotalRound.setValue(FightControler.Inst.getTotalRound());
                SetTotalRoundNum(FightControler.Inst.getTotalRound());
                // mCurRound.setValue(1);
                SetCurRoundNum(1);
            }
            onAutoForwardFinish();
        }
Beispiel #19
0
    //挑战次数是否足够(每个关卡都会配置上挑战次数限制的,不会出现无限次的挑战次数的);
    private bool isEnoughCount(StageTemplate stageT)
    {
        //不限制;
        if (stageT.m_limittime < 0)
        {
            return(true);
        }

        //获得人物身上对应关卡的已经挑战次数;
        StageData sd        = ObjectSelf.GetInstance().BattleStageData.GetStageDataByStageId(stageT.m_stageid);
        int       costTimes = sd == null ? 0 : sd.m_FightSum;

        //获得关卡的挑战总次数;
        int totalTimes = stageT.m_limittime;

        return((totalTimes <= costTimes) ? false : true);
    }
Beispiel #20
0
        //索引场景编辑器资源
        private void IndexSceneEditor()
        {
            int SceneID = 0;

            if (!SceneManager.Inst.NextloadScene.ToString().Contains("Battle"))
            {
                return;
            }
            if (ObjectSelf.GetInstance().GetIsPrompt())
            {
                SceneID = ObjectSelf.GetInstance().GetPromptCurCampaignID();
            }
            else
            {
                SceneID = ObjectSelf.GetInstance().GetCurCampaignID();
            }
            // Debug.Log(SceneManager.Inst.NextloadScene);
            StageTemplate _StageData = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(SceneID);

#if UNITY_IPHONE
            string Scenedata = "AllFormation";
            PushNeedDownBundle(Scenedata + _strRes);
#else
            string   Scenedata = "Formation100,Formation101,Formation102,Formation103,Formation110,Formation111,Formation112,Formation113,Formation120,Formation121,Formation122,Formation123,Formation130,Formation131,Formation132,Formation133,";
            string[] SceneData = Scenedata.Split(',');
            for (int i = 0; i < SceneData.Length; i++)
            {
                PushNeedDownBundle(SceneData[i] + _strRes);
            }
#endif
            for (int i = 0; i < _StageData.m_stageevent.Length; ++i)
            {
                if (_StageData.m_stageevent[i] != "-1")
                {
                    m_NeedDownEditorBundle.Add(_StageData.m_stageevent[i] + _strRes);
                }
            }
            for (int i = 0; i < _StageData.m_extraloadresource.Length; ++i)
            {
                if (_StageData.m_extraloadresource[i] != "-1")
                {
                    PushNeedDownBundle(_StageData.m_extraloadresource[i] + _strRes);
                }
            }
        }
Beispiel #21
0
    /// <summary>
    /// 根据关卡数据判断当前关卡难度;
    /// </summary>
    /// <param name="stageT"></param>
    /// <returns></returns>
    public static EM_STAGE_DIFFICULTTYPE GetStageDifficultType(StageTemplate stageT)
    {
        switch (stageT.m_stagetype)
        {
        case 1:
        case 4:
        case 5:
            return(EM_STAGE_DIFFICULTTYPE.NORMAL);

        case 2:
            return(EM_STAGE_DIFFICULTTYPE.HARD);

        case 3:
            return(EM_STAGE_DIFFICULTTYPE.HARDEST);

        default:
            return(EM_STAGE_DIFFICULTTYPE.NORMAL);
        }
    }
Beispiel #22
0
    /// <summary>
    /// 获得当前章节中指定难度第一个关卡;
    /// </summary>
    /// <param name="chapterT"></param>
    /// <param name="difficultType"></param>
    /// <returns></returns>
    public static int GetFirstStageIdInTheChapter(ChapterinfoTemplate chapterT, EM_STAGE_DIFFICULTTYPE difficultType)
    {
        if (chapterT == null)
        {
            throw new Exception("Null Refrence Exception");
        }

        int[] stageIds = chapterT.getStageID();

        if (stageIds == null || stageIds.Length <= 0)
        {
            return(-1);
        }

        int temp = -1;

        for (int i = 0, j = stageIds.Length; i < j; i++)
        {
            temp = stageIds[i];
            StageTemplate stageT = GetStageTemplateById(temp);
            if (stageT == null)
            {
                continue;
            }

            //只选主线;
            EM_STAGE_STAGETYPE stageType = GetStageStageType(stageT);
            if (stageType != EM_STAGE_STAGETYPE.MAIN)
            {
                continue;
            }

            EM_STAGE_DIFFICULTTYPE type = GetStageDifficultType(stageT);

            if (type == difficultType)
            {
                return(temp);
            }
        }

        return(-1);
    }
Beispiel #23
0
    public static List <StageTemplate> GetStageTemplatesByChapter(ChapterinfoTemplate chapterT)
    {
        if (chapterT == null || chapterT.getStageID().Length <= 0)
        {
            return(null);
        }

        List <StageTemplate> result = new List <StageTemplate>();

        for (int i = 0, j = chapterT.getStageID().Length; i < j; i++)
        {
            StageTemplate st = GetStageTemplateById(chapterT.getStageID()[i]);
            if (st == null)
            {
                continue;
            }

            result.Add(st);
        }

        return(result);
    }
Beispiel #24
0
    /// <summary>
    /// 获得玩家当前章节可以进入的最后(按id排序)一个关卡信息;
    /// </summary>
    /// <param name="chapterId"></param>
    /// <returns></returns>
    public static int GetLastStageIdInTheChapter(ChapterinfoTemplate chapterT, EM_STAGE_DIFFICULTTYPE difficultType)
    {
        List <StageData> bs = ObjectSelf.GetInstance().BattleStageData.GetStageDataListByChapterId(chapterT.getId());

        if (bs == null || bs.Count <= 0)
        {
            return(-1);
        }

        int lastStageId = -1;
        int temp        = -1;

        for (int i = 0; i < bs.Count; i++)
        {
            temp = bs[i].m_StageID;
            StageTemplate stageT = GetStageTemplateById(temp);
            if (stageT == null)
            {
                continue;
            }

            //只选主线;
            EM_STAGE_STAGETYPE stageType = GetStageStageType(stageT);
            if (stageType != EM_STAGE_STAGETYPE.MAIN)
            {
                continue;
            }

            EM_STAGE_DIFFICULTTYPE type = GetStageDifficultType(stageT);

            if (type == difficultType)
            {
                lastStageId = temp;
            }
        }

        return(lastStageId);
    }
Beispiel #25
0
    /// <summary>
    /// 获取当前章节所含有的指定类型的关卡的所有数据;
    /// </summary>
    /// <param name="chapterT"></param>
    /// <returns></returns>
    public static List <StageTemplate> GetStageDatas(ChapterinfoTemplate chapterT, int stageType)
    {
        if (chapterT == null)
        {
            return(null);
        }

        List <StageTemplate> result = new List <StageTemplate>();

        for (int i = 0, j = chapterT.getStageID().Length; i < j; i++)
        {
            StageTemplate stageT = GetStageTemplateById(chapterT.getStageID()[i]);

            if (stageT == null || stageT.m_stagetype != stageType)
            {
                continue;
            }

            result.Add(stageT);
        }

        return(result);
    }
Beispiel #26
0
    //刷新所有的levelitem;
    void UpdateLevels(ChapterinfoTemplate chapterT)
    {
        //获取当前章节所有的关卡列表;
        stageDatas = new List <StageTemplate>();
        //章节的所有普通关卡--chapterInfo表中所有的关卡表;
        //主线;
        switch (DifficultType)
        {
        case EM_STAGE_DIFFICULTTYPE.NONE:
            break;

        case EM_STAGE_DIFFICULTTYPE.NORMAL:
            List <StageTemplate> datas1 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.MAIN_QUEST1);
            stageDatas = StageModule.AddList(stageDatas, datas1);
            //支线;
            List <StageTemplate> datas4 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.SIDE_QUEST);
            stageDatas = StageModule.AddList(stageDatas, datas4);
            break;

        case EM_STAGE_DIFFICULTTYPE.HARD:
            List <StageTemplate> datas2 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.MAIN_QUEST2);
            stageDatas = StageModule.AddList(stageDatas, datas2);
            break;

        case EM_STAGE_DIFFICULTTYPE.HARDEST:
            List <StageTemplate> datas3 = StageModule.GetStageDatas(chapterT, EM_STAGE_TYPE.MAIN_QUEST3);
            stageDatas = StageModule.AddList(stageDatas, datas3);
            break;

        default:
            break;
        }
        //章节的特殊关卡;
        SpecialStage ss = ObjectSelf.GetInstance().BattleStageData.GetSpecialStageData();

        if (ss.m_StageID > 0 && (ss.m_BattlePieceNum == mCurChapterId))
        {
            //特殊关卡;
            if (StageModule.IsStageTemplate(ss.m_StageID))
            {
                StageTemplate st = StageModule.GetStageTemplateById(ss.m_StageID);
                stageDatas.Add(st);
            }
            //神秘商店;
            else
            {
                //构造一个神秘商店;
                StageTemplate st = new StageTemplate();
                st.m_stageid        = ss.m_BattlePieceNum; //章节id;
                st.m_mysteriousShop = ss.m_StageID;        //神秘商店表格id;
                st.m_CustomData     = true;
                stageDatas.Add(st);
            }
        }

        int adder = stageDatas.Count - mLevelItems.Count;

        if (adder > 0)
        {
            CreateLevels(adder);
        }

        for (int i = 0; i < mLevelItems.Count; i++)
        {
            if (i >= stageDatas.Count)
            {
                mLevelItems[i].SetTemplateData(null);
            }
            else
            {
                if (stageDatas[i].m_CustomData != null)
                {
                    mLevelItems[i].SetTemplateData(stageDatas[i], EM_STAGE_STAGETYPE.MYSTERIOUS);
                }
                else
                {
                    mLevelItems[i].SetTemplateData(stageDatas[i]);
                }

                mLevelItems[i].SetActive(true);
            }

            //设置选中状态;
            mLevelItems[i].SetSelectState(mCurLevelId);
        }
    }
Beispiel #27
0
    public override void InitUIView()
    {
        base.InitUIView();

        ObjectSelf.GetInstance().SetIsPrompt(false);

        //ChapterinfoTemplate ct = DataTemplate.GetInstance().GetChapterTemplateByStageID(1310381000);
        /////
        /////当前所打关卡没有解锁新关卡时,从战斗结算界面回到关卡选择界面时,选中的关卡仍为之前所打的那关,
        /////当前关卡打完后有新关卡解锁,返回关卡选择界面就跳到下一关(困难难度一样如此),若同时解锁了两个
        /////关卡(主线和支线),返回关卡选择界面选中主线关
        /////
        if (NeedSpecialStage)
        {
            InitLevelId = ObjectSelf.GetInstance().BattleStageData.GetSpecialStageData().m_StageID;
        }
        else
        {
            List <int> newStages = ObjectSelf.GetInstance().BattleStageData.GetNewStageList();

            if (newStages != null && newStages.Count > 0)
            {
                DisplayNormal();
            }
            else
            {
                if (ObjectSelf.GetInstance().CurStageID > 0 && StageModule.IsStageLevelById(ObjectSelf.GetInstance().CurStageID))
                {
                    InitLevelId = ObjectSelf.GetInstance().CurStageID;
                }
                else
                {
                    DisplayNormal();
                }
            }
        }

        if (InitLevelId <= 0)
        {
            if (InitChapterId <= 0)
            {
                DisplayNormal();
            }
            else
            {
                ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(InitChapterId);
                if (chapterT == null)
                {
                    DisplayNormal();
                }
                else
                {
                    mDifficutType = EM_STAGE_DIFFICULTTYPE.NORMAL;
                    mCurChapterId = InitChapterId;
                    mCurLevelId   = StageModule.GetLastStageIdInTheChapter(chapterT, mDifficutType);
                }
            }
        }
        else
        {
            StageTemplate stageT = StageModule.GetStageTemplateById(InitLevelId);
            if (stageT == null)
            {
                DisplayNormal();
            }
            else
            {
                mDifficutType = StageModule.GetStageDifficultType(stageT);
                mCurLevelId   = InitLevelId;
                int chapterId = DataTemplate.GetInstance().GetChapterIdByStageT(stageT);
                if (chapterId == -1)
                {
                    Debug.LogError("关卡stageid找不到对应的章节id,stageid=" + InitLevelId);
                }
                else
                {
                    mCurChapterId = chapterId;
                }
            }
        }
        OnNewMapOpenShow();
        Sprite inst = UIResourceMgr.LoadSprite(common.defaultPath + "Ui_guanqiabeijing");

        Dictionary <int, BattleStage> .KeyCollection keycoll = TotalCharpter.Keys;
        foreach (int chapterid in keycoll)
        {
            if (chapterid != 1001)
            {
                ChapterinfoTemplate info = StageModule.GetChapterinfoTemplateById(chapterid);
                if (info != null)
                {
                    //var info = (ChapterinfoTemplate)DataTemplate.GetInstance().m_ChapterTable.getTableData(chapterid);
                    //var info = (ChapterinfoTemplate)table[chapterid];
                    Sprite     pic  = UIResourceMgr.LoadSprite(common.defaultPath + info.getBackgroundPicture());
                    GameObject item = new GameObject("background");
                    if (pic != null)
                    {
                        item.AddComponent <Image>().sprite = Instantiate(pic, Vector3.zero, Quaternion.identity) as Sprite;
                    }
                    else
                    {
                        item.AddComponent <Image>().sprite = Instantiate(inst, Vector3.zero, Quaternion.identity) as Sprite;
                    }
                    item.transform.SetParent(mBgTrans, false);
                }
            }
        }

        Init();

        // 新手引导 100302
        if (GuideManager.GetInstance().isGuideUser&& GuideManager.GetInstance().IsContentGuideID(100302) == false)
        {
            GuideManager.GetInstance().ShowGuideWithIndex(100302);
        }
    }
Beispiel #28
0
    public void Show(StageTemplate stageT)
    {
        if (stageT == null)
        {
            Debug.LogError("关卡数据为null");
            return;
        }

        mStageT = stageT;

        //-----------------星级----------------;
        StageData sd      = ObjectSelf.GetInstance().BattleStageData.GetStageDataByStageId(stageT.m_stageid);
        int       starNum = 0;

        if (sd != null)
        {
            starNum = sd.m_StageStar;
        }

        for (int i = 0; i < 3; i++)
        {
            StarImgs[i].gameObject.SetActive(i < starNum);
        }

        int stageNum  = StageModule.GetStageNumInChapter(stageT);
        int chapterId = StageModule.GetChapterinfoIdByStageId(stageT.GetID());

        m_ChapterNameTxt.text = string.Format(GameUtils.getString("chapter_title"), GameUtils.ConverIntToString(chapterId));
        m_StageNameTxt.text   = string.Format(GameUtils.getString("guanqia_mingzi"), stageNum, GameUtils.getString(stageT.m_stagename));
        m_StageDescTxt.text   = GameUtils.getString(stageT.m_stageinfo);

        m_ResourceCount1.text = stageT.m_playerexp.ToString();
        m_ResourceCount2.text = stageT.m_goldreward.ToString();

        if (stageT.m_expcrystal == -1)
        {
            ResouceObj3.SetActive(false);
        }
        else
        {
            ResouceObj3.SetActive(true);
            m_ResourceCount3.text = stageT.m_expcrystal.ToString();
        }

        EM_STAGE_DIFFICULTTYPE difficultType = StageModule.GetStageDifficultType(stageT);
        string difficultStr = "";

        switch (difficultType)
        {
        case EM_STAGE_DIFFICULTTYPE.NONE:
            break;

        case EM_STAGE_DIFFICULTTYPE.NORMAL:
            difficultStr = GameUtils.getString("chapter_difficult_type1");
            break;

        case EM_STAGE_DIFFICULTTYPE.HARD:
            difficultStr = GameUtils.getString("chapter_difficult_type2");
            break;

        case EM_STAGE_DIFFICULTTYPE.HARDEST:
            difficultStr = GameUtils.getString("chapter_difficult_type2");
            break;

        default:
            break;
        }

        //-------------------关卡挑战次数--------------------
        //无限制;
        if (stageT.m_limittime < 0)
        {
            SetRapidObjActive(false);
        }
        else
        {
            SetRapidObjActive(true);
            int remineTimes = Mathf.Max(0, stageT.m_limittime - sd.m_FightSum);

            TEXT_COLOR tc = TEXT_COLOR.WHITE;
            if (remineTimes > 0)
            {
                tc = TEXT_COLOR.WHITE;
                m_ResetBtn.gameObject.SetActive(false);
            }
            else
            {
                m_ResetBtn.gameObject.SetActive(true);
                tc = TEXT_COLOR.RED;
            }
            m_RemindTimeTxt.text = GameUtils.getString("fight_fightprepare_content3") + GameUtils.StringWithColor(remineTimes.ToString(), tc) + "/" + stageT.m_limittime;
        }

        m_DifficultTxt.text = difficultStr;

        //行动力不足颜色标红;
        if (isEnoughPow(mStageT))
        {
            m_ConsumeCountTxt.text = stageT.m_cost.ToString();
        }
        else
        {
            m_ConsumeCountTxt.text = GameUtils.StringWithColor(stageT.m_cost.ToString(), TEXT_COLOR.RED);
        }

        switch (stageT.m_winCondition)
        {
        case 1:
            m_SucessConditionTxt.text = "◆" + GameUtils.getString("System_setting_content28");
            break;

        case 2:
            m_SucessConditionTxt.text = "◆" + string.Format(GameUtils.getString("System_setting_content29"), StageModule.GetBossName(stageT));
            break;
        }
        //--------------------敌方英雄信息------------------;
        for (int i = 0; i < mEnermyList.Count; i++)
        {
            if (mEnermyList[i] != null)
            {
                mEnermyList[i].Destroy();
            }
        }
        mEnermyList.Clear();

        List <MonsterTemplate> _BossTemp    = new List <MonsterTemplate>();
        List <MonsterTemplate> _MonsterTemp = new List <MonsterTemplate>();

        for (int i = 0, j = stageT.m_displayMonster.Length; i < j; i++)
        {
            MonsterTemplate _monster = (MonsterTemplate)DataTemplate.GetInstance().m_MonsterTable.getTableData(stageT.m_displayMonster[i]);
            if (_monster.getMonstertype() == 2)
            {
                _BossTemp.Add(_monster);
            }
            else
            {
                _MonsterTemp.Add(_monster);
            }
        }

        for (int i = 0; i < _BossTemp.Count; ++i)
        {
            UniversalItemCell cell = UniversalItemCell.GenerateItem(EnermyListTrans);
            cell.InitByID(_BossTemp[i].getId());
            cell.SetSize(UniversalItemCell.UniversalItemSize.Type_114);
            cell.SetCount("BOSS");
            cell.AddClickListener(OnClickUniversalHeroHandler);
            mEnermyList.Add(cell);
        }

        for (int i = 0; i < _MonsterTemp.Count; i++)
        {
            UniversalItemCell cell = UniversalItemCell.GenerateItem(EnermyListTrans);
            cell.InitByID(_MonsterTemp[i].getId());
            cell.SetSize(UniversalItemCell.UniversalItemSize.Type_114);
            cell.AddClickListener(OnClickUniversalHeroHandler);
            //cell.SetCount("BOSS");
            mEnermyList.Add(cell);
        }

        //--------------------关卡掉落展示------------------;
        for (int i = 0; i < mItemsList.Count; i++)
        {
            if (mItemsList[i] != null)
            {
                mItemsList[i].Destroy();
            }
        }
        mItemsList.Clear();

        string displaydrop = stageT.m_displaydrop;

        if (displaydrop == "-1" || string.IsNullOrEmpty(displaydrop))
        {
        }
        else
        {
            string[] displaydropList = displaydrop.Split('#');
            if (displaydropList.Length == 0)
            {
                return;
            }

            for (int i = 0; i < displaydropList.Length; i++)
            {
                UniversalItemCell cell = UniversalItemCell.GenerateItem(ItemListTrans);
                cell.SetSize(UniversalItemCell.UniversalItemSize.Type_114);
                cell.AddClickListener(OnClickUniversalItemHandler);
                string[] itemList = displaydropList[i].Split('-');
                switch (int.Parse(itemList[0]))
                {
                case 1:
                    int itemid = int.Parse(itemList[1]);
                    if (int.Parse(itemList[2]) == 0)
                    {
                        //几率掉落;
                        cell.InitByID(itemid);
                        cell.SetText(null, GameUtils.getString("fight_stageselect_content3"), null);
                    }
                    else
                    {
                        //一定掉落;
                        int count = System.Convert.ToInt32(itemList[3]);
                        cell.InitByID(itemid, count);
                    }
                    break;

                case 2:
                    if (int.Parse(itemList[2]) == 0)
                    {
                        cell.InitBySprite(UIResourceMgr.LoadSprite(common.defaultPath + itemList[1]));
                        cell.SetText(null, GameUtils.getString("fight_stageselect_content3"), null);
                    }
                    else
                    {
                        int count = System.Convert.ToInt32(itemList[3]);
                        cell.InitBySprite(UIResourceMgr.LoadSprite(common.defaultPath + itemList[1]), count);
                    }
                    break;

                default:
                    break;
                }

                mItemsList.Add(cell);
            }
        }
    }
Beispiel #29
0
        public void init(StageTemplate stageinfo, int idx)
        {
            isSelect        = false;
            isOpen          = false;
            this.iStageID   = stageinfo.m_stageid;
            this.iIdx       = idx + 1;
            this.mStageInfo = stageinfo;

            var table = stageinfo;

            if (stageinfo.m_stagetype != 6)
            {
                if (stageinfo.m_stagetype != 7)
                {
                    GetComponent <RectTransform>().anchoredPosition3D = new Vector3(table.getStageiconposition()[0], table.getStageiconposition()[1], 0);
                    if (stageinfo.m_stagetype != 4)
                    {
                        mlevel.text = string.Format("{0}-{1}", ObjectSelf.GetInstance().GetCurChapterID(), iIdx);
                    }
                    else
                    {
                        mlevel.text = GameUtils.getString("stage_type_branch"); //"支线"
                    }
                }
            }
            if (stageinfo.m_stagetype == 6 || stageinfo.m_stagetype == 7)
            {
                // mlevel.text = GameUtils.getString(stageinfo.m_stagename);
            }

            var info = ObjectSelf.GetInstance();

            if (ObjectSelf.GetInstance().GetIsPrompt())
            {
                //list = info.BattleStageData.m_BattleStageList[1001];
                list = info.BattleStageData.GetBattleStageByChapterId(1001);
            }
            else
            {
                //if (info.BattleStageData.m_BattleStageList.ContainsKey(info.GetCurChapterID()))
                //{
                //    list = info.BattleStageData.m_BattleStageList[info.GetCurChapterID()];
                //}
                BattleStage bs = info.BattleStageData.GetBattleStageByChapterId(info.GetCurChapterID());
                if (bs != null)
                {
                    list = bs;
                }
            }
            if (transform.FindChild("limit") != null)
            {
                mLimit = transform.FindChild("limit").gameObject;
            }
            StageData data = list == null ? null : list.GetStageData(iStageID);

            mTag.SetActive(false);
            if (data != null)
            {
                isOpen = true;

                // 初始化
                switch (data.m_StageStar)
                {
                case 0:
                {
                    mStart0.gameObject.SetActive(false);
                    mStart1.gameObject.SetActive(false);
                    mStart2.gameObject.SetActive(false);
                    if (info.BattleStageData.isStageNew(this.iStageID))
                    {
                        mTag.SetActive(true);
                        newFight = true;
                    }
                }
                break;

                case 1:
                {
                    mStart0.gameObject.SetActive(true);
                    mStart1.gameObject.SetActive(false);
                    mStart2.gameObject.SetActive(false);
                }
                break;

                case 2:
                {
                    mStart0.gameObject.SetActive(false);
                    mStart1.gameObject.SetActive(true);
                    mStart2.gameObject.SetActive(false);
                }
                break;

                case 3:
                {
                    mStart0.gameObject.SetActive(false);
                    mStart1.gameObject.SetActive(false);
                    mStart2.gameObject.SetActive(true);
                }
                break;
                }
                // 开启
                //if (UI_SelectFightArea.Inst != null)
                //{
                //    mIcon.overrideSprite = Instantiate(UI_SelectFightArea.Inst.mHadOpenItemSprite) as Sprite;
                //    mlevel.color = Color.white;
                //    //selfTransform.FindChild("icon").GetComponent<Button>().enabled = true;

                //}
                //else
                {
                    transform.GetComponent <Button>().enabled = true;
                    mIcon.overrideSprite = Instantiate(UI_PromptFightArea.Inst.mHadOpenItemSprite) as Sprite;
                    mlevel.color         = Color.white;
                }
                if (mLimit != null)
                {
                    mLimitValue = mLimit.transform.FindChild("value").GetComponent <Text>();
                    if (stageinfo.m_limittime == -1 || stageinfo.m_limittime - data.m_FightSum > 10)
                    {
                        mLimit.SetActive(false);
                    }
                    else
                    {
                        mLimit.SetActive(true);
                        mLimitValue.text = (stageinfo.m_limittime - data.m_FightSum).ToString();
                    }
                }
            }
            else
            {
                //GameObject.Destroy(gameObject);
                isOpen = false;
                mStart0.gameObject.SetActive(false);
                mStart1.gameObject.SetActive(false);
                mStart2.gameObject.SetActive(false);
                // 未开启
                //if (UI_SelectFightArea.Inst != null)
                //{
                //    mIcon.overrideSprite = Instantiate(UI_SelectFightArea.Inst.mHadNotOpenSprite) as Sprite;
                //    mlevel.color = Color.gray;

                //    //selfTransform.FindChild("icon").GetComponent<Button>().enabled = false;
                //}
                //else
                {
                    mIcon.overrideSprite = Instantiate(UI_PromptFightArea.Inst.mHadNotOpenSprite) as Sprite;
                    mlevel.color         = Color.gray;
                    transform.GetComponent <Button>().enabled = false;
                }
                if (mLimit != null)
                {
                    mLimit.SetActive(false);
                }
            }
        }
Beispiel #30
0
        // ============================= 继承接口 =================================
        // 第一步初始化数据 [1/19/2015 Zmy]
        protected override void InitData()
        {
            if (_inst == null)
            {
                _inst = this;
            }
            else
            {
                GameObject.Destroy(this);
            }
            CurRound = 0;
            if (ObjectSelf.GetInstance().GetIsPrompt())
            {
                m_StageID = ObjectSelf.GetInstance().GetPromptCurCampaignID();
            }
            else
            {
                m_StageID = ObjectSelf.GetInstance().GetCurCampaignID();
            }
            m_StageRow                = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(m_StageID);
            m_FightCountDown          = m_StageRow.m_fightTime;
            m_ReviseHeroPosCount      = 0;
            m_MonmentMoveHeroPosCount = 0;
            m_DisappearCount          = 0;
            m_HeroPower               = new BattleAnger(EM_OBJECT_TYPE.EM_OBJECT_TYPE_HERO);
            m_EnemyPower              = new BattleAnger(EM_OBJECT_TYPE.EM_OBJECT_TYPE_MONSTER);

            SceneManager.Inst.EndChangeScene(SceneEntry.Fight.ToString());
            this.gameObject.AddComponent <FightEditorContrler>();
            this.gameObject.AddComponent <SceneObjectManager>();
            this.gameObject.AddComponent <EffectManager>();
            this.gameObject.AddComponent <GameTimeControler>();
            //初始化英雄和怪物AI检测时间间隔
            AILogicHero.GetInstance().SetAItime(DataTemplate.GetInstance().m_GameConfig.getPlayer_ai_check());
            AILogicMonster.GetInstance().SetAItime(m_StageRow.m_aiCheck);
            SetFightAIState(EM_SPELL_AI_TYPE.EM_SPELL_AI_TYPE_INVALID);

            // 添加UI
            Instantiate(Resources.Load("UI/Prefabs/Core/UI_FightControler"), Vector3.zero, Quaternion.identity);

            //监听初始化编辑器完成事件 [1/20/2015 Zmy]
            GameEventDispatcher.Inst.addEventListener(GameEventID.SE_FightEditorLoadDone, CallBack_InitHeroEffect);
            //监听触发战斗事件准备创建怪物事件 [1/20/2015 Zmy]
            GameEventDispatcher.Inst.addEventListener(GameEventID.SE_PrepareEnemy, CallBack_PrepareEnemy);
            //监听进入战斗状态事件 [1/20/2015 Zmy]
            GameEventDispatcher.Inst.addEventListener(GameEventID.SE_EnterFightState, CallBack_EnterFightState);
            //监听剧情播放事件 [1/21/2015 Zmy]
            GameEventDispatcher.Inst.addEventListener(GameEventID.SE_StoryEnter, CallBack_StoryEnter);
            //监听剧情开场播放事件
            GameEventDispatcher.Inst.addEventListener(GameEventID.SE_StoryCameraEnter, CallBack_StoryCameraEnter);
            //监听瞬间移动进入事件
            GameEventDispatcher.Inst.addEventListener(GameEventID.SE_HeroPathMomentMoveEnter, CallBack_eroPathMomentMoveEnter);
            //监听瞬间移动退出事件
            GameEventDispatcher.Inst.addEventListener(GameEventID.SE_HeroPathMomentMoveExit, CallBack_eroPathMomentMoveExit);
            //准备登上载具;
            GameEventDispatcher.Inst.addEventListener(GameEventID.SE_PrepareBoard, CallBack_PrepareBoard);
            //下船;
            GameEventDispatcher.Inst.addEventListener(GameEventID.SE_BoardingOver, CallBack_BoardingOver);

            m_BossAudio    = UIResourceMgr.LoadPrefab(common.AudioPath + "boss1") as AudioClip;
            m_Battle1Audio = UIResourceMgr.LoadPrefab(common.AudioPath + "battle1") as AudioClip;
            m_Battle2Audio = UIResourceMgr.LoadPrefab(common.AudioPath + "battle2") as AudioClip;
        }