Ejemplo n.º 1
0
    private void ShowAwardItemsView()
    {
        DCopy          copyDB  = ReadCfgCopy.GetDataById(mCopyID);
        int            awardID = copyDB.AwardId;
        List <KStruct> list    = AwardModule.Instance.GetAwardDataByID(awardID);

        if (list == null)
        {
            return;
        }
        for (int i = 0; i < items.Count; i++)
        {
            ItemAward tab = items[i];
            if (i < items.Count)
            {
                KStruct data = list[i];
                tab.itemBtn.SetActive(true);
                GTItemHelper.ShowItemTexture(tab.itemTexture, data.Id);
                GTItemHelper.ShowItemQuality(tab.itemQuality, data.Id);
                GTItemHelper.ShowItemChip(tab.itemChip, data.Id);
                UIEventListener.Get(tab.itemBtn).onClick = delegate(GameObject go)
                {
                    GTItemHelper.ShowItemDialogById(data.Id);
                };
            }
            else
            {
                tab.itemBtn.SetActive(false);
            }
        }
    }
Ejemplo n.º 2
0
    private void PlayFailContentTween()
    {
        DCopy db = ReadCfgCopy.GetDataById(LevelData.CopyID);

        if (db == null)
        {
            return;
        }
        for (int i = 0; i < mPassContents.Length; i++)
        {
            ItemPassContent tab  = mPassContents[i];
            EStarCondition  type = db.StarConditions[i];
            int             v    = db.StarValues[i];
            switch (type)
            {
            case EStarCondition.TYPE_MAIN_HEALTH:
                tab.text.text = GTTools.Format("主角血量大于{0}%", v);
                break;

            case EStarCondition.TYPE_PASSCOPY:
                tab.text.text = "通关副本";
                break;

            case EStarCondition.TYPE_TIME_LIMIT:
                tab.text.text = GTTools.Format("{0}秒通关副本", v);
                break;
            }
            tab.trans.gameObject.SetActive(true);
        }
    }
Ejemplo n.º 3
0
 private void OnMusicToggle(GameObject go)
 {
     GTAudioManager.Instance.SetMusicActive(!GTAudioManager.Instance.MusicActive);
     if (GTAudioManager.Instance.MusicActive)
     {
         DCopy db = ReadCfgCopy.GetDataById(GTGlobal.CurCopyID);
         GTAudioManager.Instance.PlayMusic(db.SceneMusic);
     }
 }
Ejemplo n.º 4
0
    public AsyncOperation LoadLevelById(int id)
    {
        DCopy db = ReadCfgCopy.GetDataById(id);

        if (string.IsNullOrEmpty(db.SceneName))
        {
            return(null);
        }
        ReleaseResource();
        return(SceneManager.LoadSceneAsync(db.SceneName));
    }
Ejemplo n.º 5
0
    public void ShowViewByChapter(int chapterID)
    {
        mChapter = chapterID;
        DWorld chapterDB = ReadCfgWorld.GetDataById(chapterID);

        for (int i = 0; i < 3; i++)
        {
            mBoxStarNums[i].text = chapterDB.Stars[i].ToString();
            int rewardState = RaidModule.Instance.GetChapterRewardStateByAwardIndex(chapterID, i);
            switch (rewardState)
            {
            case ERewardState.NOT_RECEIVE:
            case ERewardState.CAN_RECEIVE:
                mBoxStates[i].spriteName = "613";
                break;

            case ERewardState.HAS_RECEIVE:
                mBoxStates[i].spriteName = "614";
                break;
            }
        }

        int copysNum = chapterDB.Copys.Length;

        mChapterName.text = chapterDB.Name;
        GTItemHelper.ShowTexture(mMapTexture, chapterDB.Map);
        int enterIndex = RaidModule.Instance.GetMaxCanEnterCopyIndex(mCurCopyType, chapterID);

        for (int i = 0; i < mCopyItems.Count; i++)
        {
            ItemCopy item = mCopyItems[i];
            if (i < copysNum)
            {
                item.item.SetActive(true);
                item.Show(i < enterIndex);
                int   copyID  = chapterDB.Copys[i];
                DCopy db      = ReadCfgCopy.GetDataById(copyID);
                int   starNum = RaidModule.Instance.GetCopyStarNumById(copyID);
                item.copyName.text = db.Name;
                item.item.transform.localPosition = chapterDB.CopyPosArray[i];
                GTItemHelper.ShowStarNum(item.stars, starNum);
            }
            else
            {
                mCopyItems[i].item.SetActive(false);
            }
            if (i == enterIndex - 1)
            {
                mLight.gameObject.SetActive(false);
                mLight.transform.parent        = item.item.transform;
                mLight.transform.localPosition = Vector3.zero;
            }
        }
    }
Ejemplo n.º 6
0
    public void LoadScene(int sceneId, Callback finishCallback = null)
    {
        DCopy db = ReadCfgCopy.GetDataById(sceneId);

        this.NextCopyType = db.CopyType;
        CommandLoadScene cmd = new CommandLoadScene();

        cmd.SceneID = sceneId;
        SceneLoading s = (SceneLoading)mStateMachine.GetState(ECopyType.TYPE_LOAD);

        s.mCallback = finishCallback;
        ChangeState(ECopyType.TYPE_LOAD, cmd);
    }
Ejemplo n.º 7
0
    void OnSceneWasLoaded()
    {
        DCopy db = ReadCfgCopy.GetDataById(mLoadingSceneId);

        GTAudioManager.Instance.PlayMusic(db.SceneMusic);
        GTLauncher.Instance.ChangeState(GTLauncher.Instance.NextCopyType, Cmd);
        if (db.CopyType == ECopyType.TYPE_LOGIN ||
            db.CopyType == ECopyType.TYPE_ROLE)
        {
            GTWorld.Instance.ResetGuide();
            GTWorld.Instance.EnterWorld(mLoadingSceneId);
        }
    }
Ejemplo n.º 8
0
    private void ShowViewByChapter(int chapter)
    {
        this.chapter = chapter;
        DCopyMainChapter chapterDB = ReadCfgCopyMainChapter.GetDataById(chapter);
        int enterIndex             = MLRaid.Instance.GetMaxCanEnterCopyIndex(copyDifficulty, chapter);

        for (int i = 0; i < 3; i++)
        {
            boxStarNums[i].text = chapterDB.Stars[i].ToString();
            ERewardState rewardState = MLRaid.Instance.GetChapterRewardStateByAwardIndex(chapter, i);
            switch (rewardState)
            {
            case ERewardState.NOT_RECEIVE:
            case ERewardState.CAN_RECEIVE:
                boxStates[i].spriteName = "613";
                break;

            case ERewardState.HAS_RECEIVE:
                boxStates[i].spriteName = "614";
                break;
            }
        }
        chapterName.text = chapterDB.Name;
        for (int i = 0; i < copyItems.Count; i++)
        {
            ItemCopy tab = copyItems[i];
            if (i < chapterDB.Copys.Length)
            {
                tab.item.SetActive(true);
                Color color = i < enterIndex ? Color.white : Color.cyan;
                tab.icon.color = color;
                for (int k = 0; k < tab.stars.Length; k++)
                {
                    tab.stars[k].color = color;
                }
                int   copyID  = chapterDB.Copys[i];
                DCopy db      = ReadCfgCopy.GetDataById(copyID);
                int   starNum = MLRaid.Instance.GetCopyStarNumById(copyID);
                tab.copyName.text  = db.Name;
                tab.copyName.color = i < enterIndex ? Color.yellow : Color.gray;
                tab.item.transform.localPosition = chapterDB.CopyPosArray[i];
                GTItemHelper.ShowStarNum(tab.stars, starNum);
            }
            else
            {
                copyItems[i].item.SetActive(false);
            }
        }
        btnPrev.SetActive(chapter > DCopyMainChapter.MAINCOPY_ST_CHAPTER_ID);
        btnNext.SetActive(chapter < DCopyMainChapter.MAINCOPY_ED_CHAPTER_ID);
    }
Ejemplo n.º 9
0
    public void TryMainCopyReq(UInt64 roleGUID, Int32 dwCopyID)
    {
        DCopy copyDB = ReadCfgCopy.GetDataById(dwCopyID);

        if (GTItemHelper.CheckItemEnongh(copyDB.CostActionId, copyDB.CostActionNum) == false)
        {
            return;
        }

        MainCopyReq req = new MainCopyReq();

        req.CopyID = dwCopyID;
        NetworkManager.Instance.Send <MainCopyReq>(MessageID.MSG_MAIN_COPY_REQ, req, roleGUID, 0);
    }
Ejemplo n.º 10
0
    private void ShowView()
    {
        DCopy copyDB = ReadCfgCopy.GetDataById(mCopyID);

        gateCopyType.text = "简单模式";
        GTItemHelper.ShowTexture(gateTexture, copyDB.Texture);
        gateName.text        = copyDB.Name;
        gateDesc.text        = copyDB.Desc;
        gateFightValue.text  = GTTools.Format("推荐战力值:{0}", copyDB.FightValue);
        gateBattleTimes.text = string.Empty;
        costActionNum.text   = copyDB.CostActionNum.ToString();
        GTItemHelper.ShowItemTexture(costActionTexture, copyDB.CostActionId);
        ShowAwardItemsView();
    }
Ejemplo n.º 11
0
    private void OnAck_BattleCheck(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        AckBattleCheck         ack = Serializer.Deserialize <AckBattleCheck>(ms);

        GTEventCenter.FireEvent(GTEventID.TYPE_BATTLE_CHECK);
        DCopy db = ReadCfgCopy.GetDataById(ack.CopyID);

        LVL.LevelData.CopyID   = ack.CopyID;
        LVL.LevelData.Chapter  = ack.Chapter;
        LVL.LevelData.CopyType = (ECopyType)ack.CopyType;
        LVL.LevelData.SceneID  = db.SceneId;
        LVL.LevelData.Win      = false;
        LVL.LevelData.Star     = 0;

        GTLauncher.Instance.LoadScene(db.SceneId);
    }
Ejemplo n.º 12
0
    public void TryBattleCheck(ECopyType copyType, int chapter, int copyID)
    {
        if (CheckCopy(copyType, chapter, copyID) == false)
        {
            return;
        }
        DCopy copyDB = ReadCfgCopy.GetDataById(copyID);

        if (GTItemHelper.CheckItemEnongh(copyDB.CostActionId, copyDB.CostActionNum) == false)
        {
            return;
        }


        ReqBattleCheck req = new ReqBattleCheck();

        req.CopyType = (int)copyType;
        req.CopyID   = copyID;
        req.Chapter  = chapter;
        NetworkManager.Instance.Send <ReqBattleCheck>(MessageID.MSG_REQ_BATTLE_CHECK, req);
    }
Ejemplo n.º 13
0
    private void InitWinItems()
    {
        mGrid.gameObject.SetActive(true);
        DCopy db = ReadCfgCopy.GetDataById(LevelData.CopyID);

        if (db == null)
        {
            return;
        }
        List <KStruct> list = AwardModule.Instance.GetAwardDataByID(db.AwardId);

        if (list == null)
        {
            return;
        }
        for (int i = 0; i < list.Count; i++)
        {
            GameObject item = NGUITools.AddChild(mGrid.gameObject, mTemp);
            mGrid.AddChild(item.transform);

            UITexture  itemTexture = item.transform.Find("Texture").GetComponent <UITexture>();
            UISprite   itemQuality = item.transform.Find("Quality").GetComponent <UISprite>();
            UILabel    itemNum     = item.transform.Find("Num").GetComponent <UILabel>();
            GameObject itemChip    = item.transform.Find("Chip").gameObject;

            KStruct data = list[i];
            GTItemHelper.ShowItemTexture(itemTexture, data.Id);
            GTItemHelper.ShowItemQuality(itemQuality, data.Id);
            GTItemHelper.ShowItemNum(itemNum, data.Num);
            GTItemHelper.ShowItemChip(itemChip, data.Id);

            UIEventListener.Get(item).onClick = delegate(GameObject go)
            {
                GTItemHelper.ShowItemDialogById(data.Id);
            };
        }
        mGrid.repositionNow = true;
    }
Ejemplo n.º 14
0
    private void PlayWinMoneyTween()
    {
        mMoneysTrans.gameObject.SetActive(true);
        DCopy db = ReadCfgCopy.GetDataById(LevelData.CopyID);

        if (db == null)
        {
            return;
        }
        XCharacter role = RoleModule.Instance.GetCurPlayer();

        int [] idArray = new int[2] {
            db.GetMoneyId, 50
        };
        int [] numArray = new int[2]  {
            db.GetMoneyRatio *role.Level, db.GetExpRatio *role.Level
        };
        for (int i = 0; i < mMoneys.Length; i++)
        {
            ItemMoney tab = mMoneys[i];
            GTItemHelper.ShowItemTexture(tab.moneyTexture, idArray[i]);
            GTItemHelper.ShowItemNum(tab.moneyNum, numArray[i]);
        }
    }
Ejemplo n.º 15
0
    private void OnAck_PassCopy(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        AckPassCopy            ack = Serializer.Deserialize <AckPassCopy>(ms);
        int chapter  = ack.Chapter;
        int copyID   = ack.CopyID;
        int copyType = ack.CopyType;
        int starNum  = ack.StarNum;

        XCopy copy;

        if (!DataDBSCopy.ContainsKey(copyID))
        {
            copy         = new XCopy();
            copy.Id      = copyID;
            copy.StarNum = starNum;
        }
        else
        {
            copy = DataDBSCopy.GetDataById(copyID);
            if (copy.StarNum < starNum)
            {
                copy.StarNum = starNum;
            }
        }
        DataDBSCopy.Update(copyID, copy);
        DCopy copyDB = ReadCfgCopy.GetDataById(copyID);

        GTDataManager.Instance.UseAction(copyDB.CostActionId, copyDB.CostActionNum);
        int   key = (int)copyType;
        XRaid raid;

        if (!DataDBSRaid.ContainsKey(key))
        {
            raid = new XRaid();
        }
        else
        {
            raid = DataDBSRaid.GetDataById(key);
        }

        raid.MaxChapter = chapter;
        raid.MaxCopyId  = copyID;
        raid.Id         = key;
        DataDBSRaid.Update(key, raid);

        if (starNum > 0)
        {
            XCharacter role = RoleModule.Instance.GetCurPlayer();
            RoleService.Instance.TryAddRoleExp(copyDB.GetExpRatio * role.Level);

            GTDataManager.Instance.AddMoney(copyDB.GetMoneyId, copyDB.GetMoneyRatio * role.Level);
            GTDataManager.Instance.UseAction(copyDB.CostActionId, copyDB.CostActionNum);
            List <KStruct> list = AwardModule.Instance.GetAwardDataByID(copyDB.AwardId);
            if (list != null)
            {
                GTDataManager.Instance.AddNewItemList(list, false);
            }
        }

        GTEventCenter.FireEvent(GTEventID.TYPE_PASS_COPY);
    }