Exemplo n.º 1
0
 public SubCopy(Int32 id)
 {
     subCopyID     = id;
     count         = 0;
     copyState     = CopyState.UNOPEN;
     tblCopyDetail = TableManager.GetCopydetailByID(subCopyID);
 }
Exemplo n.º 2
0
    public void Show(int copy_id, bool before, int header_id)
    {
        gameObject.SetActive(true);
        mBefore = before;
        Tab_Card tab_card = TableManager.GetCardByID(header_id);

        if (tab_card != null)
        {
            AtlasManager.Instance.SetBodyName(headerTex, TableManager.GetAppearanceByID(tab_card.Appearance).BodyIcon);
            headerName.text = LanguageManger.GetWords(TableManager.GetAppearanceByID(tab_card.Appearance).Name);
        }

        Tab_Copydetail tab_detail = TableManager.GetCopydetailByID(copy_id);

        if (before)
        {
            if (tab_detail != null)
            {
                copyText.text = LanguageManger.GetWords(tab_detail.FontText);
            }
            string key = "copy_front_" + Obj_MyselfPlayer.GetMe().accountID + "_" + Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID;
            PlayerPrefs.SetInt(key, 1);
        }
        else
        {
            if (tab_detail != null)
            {
                copyText.text = LanguageManger.GetWords(tab_detail.BackText);
            }
            string key = "copy_back_" + Obj_MyselfPlayer.GetMe().accountID + "_" + Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID;
            PlayerPrefs.SetInt(key, 1);
        }
    }
    public void SetSubCopyID(int id)
    {
        subCopyID = id;
        Tab_Copydetail tab_detail = TableManager.GetCopydetailByID(subCopyID);

        if (tab_detail == null)
        {
            LogModule.ErrorLog("SetSubCopyID(), set scene background failed! id = " + id);
        }
    }
        private void PlayBackgroundMusicRandom()
        {
            int            copy_id    = UnityEngine.Random.Range(1, 180);
            Tab_Copydetail tab_detail = TableManager.GetCopydetailByID(copy_id);

            if (tab_detail != null)
            {
                AudioManager.Instance.PlayBackgroundMusic(tab_detail.CopyMusic);
            }
            else
            {
                tab_detail = TableManager.GetCopydetailByID(1);
                AudioManager.Instance.PlayBackgroundMusic(tab_detail.CopyMusic);
            }
        }
    public void Show(int copy_id)
    {
        gameObject.SetActive(true);
        copyID        = copy_id;
        tblCopyDetail = TableManager.GetCopydetailByID(copy_id);

        Tab_Card       tbl_card   = TableManager.GetCardByID(tblCopyDetail.NoticeLeft);
        Tab_Appearance tbl_appear = null;

        if (tbl_card != null)
        {
            tbl_appear          = TableManager.GetAppearanceByID(tbl_card.Appearance);
            leftName.spriteName = tbl_appear.ImgName;
            AtlasManager.Instance.SetBodyName(leftPerson, tbl_appear.BodyIcon);
        }
        if (tbl_card != null && TableManager.GetSkillByID(tbl_card.SkillComb) != null)
        {
            int dis_id = TableManager.GetSkillByID(tbl_card.SkillComb).Effect;
            hetiName.text = LanguageManger.GetWords(TableManager.GetSkillDisplayByID(dis_id).Name);
            hetiText.text = LanguageManger.GetWords(tblCopyDetail.NoticeText);

            string wengzi_anim = TableManager.GetSkillDisplayByID(TableManager.GetSkillByID(tbl_card.SkillComb).Effect).AttackAnim;

            GameObject go = Resources.Load("HetiWenZi/" + wengzi_anim, typeof(GameObject)) as GameObject;
            mWengzi = GameObject.Instantiate(go) as GameObject;
            mWengzi.transform.parent                   = wengziPos.transform.parent;
            mWengzi.transform.localPosition            = wengziPos.transform.localPosition;
            mWengzi.transform.localScale               = Vector3.one;
            mWengzi.GetComponent <Animation>().enabled = false;
        }
        else
        {
            Debug.LogError("HeTiPromptUI.Show(), card has no heti skill, card id = " + tblCopyDetail.NoticeLeft);
        }

        tbl_card = TableManager.GetCardByID(tblCopyDetail.NoticeRight);
        if (tbl_card != null)
        {
            tbl_appear           = TableManager.GetAppearanceByID(tbl_card.Appearance);
            rightName.spriteName = tbl_appear.ImgName;
            AtlasManager.Instance.SetBodyName(rightPerson, tbl_appear.BodyIcon);
        }
    }
    public void ReturnToPVEBossList()
    {
        Debug.Log("xlym: FriendShipSettleController return to ReturnToPVEBossList");
        //这里新手引导中必须返回主界面
        if (!GuideManager.Instance.isEnd())
        {
            if (GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY1_3_END)
            {
                GuideManager.Instance.FinishedStep(GuideManager.GUIDE_STEP.COPY1_3_END);
                ReturnToMainUI();
                return;
            }
            else if (GuideManager.Instance.currentStep != GuideManager.GUIDE_STEP.COPY1_3)
            {
                ReturnToMainUI();
                return;
            }
            else if (GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY1_3)
            {
                //不做处理,跳转至pve列表
            }
        }
        if (Obj_MyselfPlayer.GetMe().battleData.isWin)
        {
            GameObject.FindWithTag("main_controller").SendMessage("showBottomBar");

            if (Obj_MyselfPlayer.GetMe().isLastBattleNotFinish)
            {
                mainLogic.SendMessage("LoadPveSceneList");
                return;
            }
            int nextSubCopy = Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID + 1;
            Debug.Log("NextCopyID : " + nextSubCopy);
            List <SubCopy> subCopys = Obj_MyselfPlayer.GetMe().normalCopys;
            Debug.Log("GetMe().normalCopys.Count = " + subCopys.Count);
            bool isMainCopyOpen = true;
            foreach (SubCopy sub in subCopys)
            {
                if (sub.subCopyID == nextSubCopy)
                {
                    isMainCopyOpen = false;
                }
            }
            Tab_Copydetail nextSubDetail = TableManager.GetCopydetailByID(nextSubCopy);
            if (nextSubDetail == null) //如果获取下一副本不存在,要返回当前大副本小副本列表 可能发生在最后一个小副本
            {
                Debug.Log("No Next Copy [NextCopyDetail is Null]");
                mainLogic.SendMessage("LoadPveBossList");
                return;
            }
            Debug.Log("GetMe().curSubcopy.tblCopyDetail.Copyfather = " + Obj_MyselfPlayer.GetMe().curSubcopy.tblCopyDetail.Copyfather);
            if (nextSubDetail.Copyfather == Obj_MyselfPlayer.GetMe().curSubcopy.tblCopyDetail.Copyfather)
            {
                isMainCopyOpen = false;
            }
            if (!isMainCopyOpen) //没有大副本开启
            {
                Debug.Log("No Main Copy New Open");
                mainLogic.SendMessage("LoadPveBossList");
            }
            else
            {
                Tab_Copy nextMainCopy = TableManager.GetCopyByID(nextSubDetail.Copyfather);
                if (Obj_MyselfPlayer.GetMe().level >= nextMainCopy.PlayerLevel) //等级足够进入新大副本
                {
                    Debug.Log("Level is OK For New Main Copy -> UserLevel : " + Obj_MyselfPlayer.GetMe().level + " Need : " + nextMainCopy.PlayerLevel);
                    Debug.Log("GetMe().normalMainCopys.Count = " + Obj_MyselfPlayer.GetMe().normalMainCopys.Count);
                    foreach (MainCopy mainCopy in Obj_MyselfPlayer.GetMe().normalMainCopys)
                    {
                        if (mainCopy.copyId == nextSubDetail.Copyfather)
                        {
                            if (Obj_MyselfPlayer.GetMe().isNextMainOpened)
                            {
                                Debug.Log("NextMainOpened");
                                mainLogic.SendMessage("LoadPveBossList");//非首次打开 返回当前大副本小副本列表
                                return;
                            }
                            else if (mainCopy.copyId == 2) //如果是第二个大副本,并且是首次打开
                            {
                                Debug.Log("No.2 Main New Open");
                                if (GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.GIFT)
                                {
                                    GuideManager.Instance.isInSubStep = false;
                                }
                                mainLogic.SendMessage("ReturnToMainUI"); //首次打开第二大副本 返回主界面
                                return;
                            }
                            else
                            {
                                Obj_MyselfPlayer.GetMe().curMainCopy = mainCopy; //首次打开其他大副本-跳转到新开启大副本的小副本列表
                            }
                            break;
                        }
                    }
                }
                Debug.Log("Level < Request || Other Main Copy New Open");
                mainLogic.SendMessage("LoadPveBossList");
            }
        }
        else
        {
            mainLogic.SendMessage("onBattleFailWindow");
        }
        //		GameObject.FindWithTag("main_controller").SendMessage("showBottomBar");
        //		mainLogic.SendMessage("LoadPveBossList");
    }
    // Use this for initialization
    void Start()
    {
        battleType = Obj_MyselfPlayer.GetMe().battleType;
        ResourceManager.Instance.load_map_num = 0;
        if (battleType == BattleType.CHONG_LOU)
        {
            StartCoroutine(ResourceManager.Instance.AsyncLoadBattleBackground(ChonglouSprite[0], "BattleUICollectionChonglou", "qianchonglou"));
            StartCoroutine(ResourceManager.Instance.AsyncLoadBattleBackground(ChonglouSprite[1], "BattleUICollectionChonglou", "qianchonglou"));
            StartCoroutine(ResourceManager.Instance.AsyncLoadBattleBackground(ChonglouSprite[2], "BattleUICollectionChonglou", "qianchonglou"));

            return;
        }

        string sceneLib  = "";
        string sceneName = "";


        switch (Obj_MyselfPlayer.GetMe().battleType)
        {
        case BattleType.PVE:
            Tab_Copydetail tab_det = TableManager.GetCopydetailByID(subCopyID);
            if (tab_det == null)
            {
                Debug.LogWarning("SetSubCopyID(), set scene background failed! id = " + subCopyID);
                //这里如果没有,用第一个副本的场景, 无量剑西宗	1
                subCopyID = 134;
                tab_det   = TableManager.GetCopydetailByID(subCopyID);
            }
            sceneLib  = tab_det.SceneLib;
            sceneName = tab_det.SceneName;
            break;

        case BattleType.PVP:
        case BattleType.QxzbPvP:
            Tab_Copydetail tab_detail = null;
            while (tab_detail == null)
            {
                int va = Random.Range(1, 180);
                tab_detail = TableManager.GetCopydetailByID(va);
            }
            sceneLib  = tab_detail.SceneLib;
            sceneName = tab_detail.SceneName;
            break;

        case BattleType.WORLD_BOSS:
            Tab_Worldboss tab_worldBoss = TableManager.GetWorldbossByID(Obj_MyselfPlayer.GetMe().activeBoss.id);
            if (tab_worldBoss == null)
            {
                Debug.LogError("world_boss id error");
            }
            else
            {
                sceneLib  = tab_worldBoss.SceneLib;
                sceneName = tab_worldBoss.SceneName;
            }
            break;
        }

        GameObject battle_logic = GameObject.Find("BattleLogic");

        roundCounter = battle_logic.GetComponent <BattleLogic> ().GetBattleCore().GetBattlePlayer().RoundCounter;
        if (roundCounter == 1)
        {
            Vector3 temp = transform.localPosition;
            temp.y = bgPos_1;
            transform.localPosition = temp;
        }
        else if (roundCounter == 2)
        {
            Vector3 temp = transform.localPosition;
            temp.y = bgPos_2;
            transform.localPosition = temp;
        }
        else if (roundCounter == 3)
        {
            Vector3 temp = transform.localPosition;
            temp.y = bgPos_3;
            transform.localPosition = temp;
        }
        StartCoroutine(ResourceManager.Instance.AsyncLoadBattleBackground(headSprite, sceneLib, sceneName + "-1"));
        StartCoroutine(ResourceManager.Instance.AsyncLoadBattleBackground(middleSprite, sceneLib, sceneName + "-2"));
        StartCoroutine(ResourceManager.Instance.AsyncLoadBattleBackground(bottomSprite, sceneLib, sceneName + "-3"));
    }
Exemplo n.º 8
0
    void Start()
    {
        logicTarget = GameObject.Find("MainUILogic");
        InitCopys();

        Obj_MyselfPlayer.GetMe().UpdateCopyList(CopyType.NORMAL);
        normalCopys = Obj_MyselfPlayer.GetMe().normalMainCopys;
        CreateCopyList(CopyType.NORMAL);
        Obj_MyselfPlayer.GetMe().UpdateCopyList(CopyType.ACTIVITY);
        activityCopys = Obj_MyselfPlayer.GetMe().activityMainCopys;
        CreateCopyList(CopyType.ACTIVITY);
        EnalbleCopy(Obj_MyselfPlayer.GetMe().copyType);

        if (Obj_MyselfPlayer.GetMe().isLastBattleNotFinish)  //如果是战斗中断返回的那场战斗,需要以下代码处理跳转
        {
            Obj_MyselfPlayer.GetMe().isLastBattleNotFinish = false;
            int curMainCopyID = Obj_MyselfPlayer.GetMe().curSubcopy.tblCopyDetail.Copyfather; //中断的战斗的大副本ID
            curMainCopyID--;                                                                  //在List里从0开始,因此CopyID需要减1

            int nextSubCopy = Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID + 1;
            Debug.Log("NextCopyID : " + nextSubCopy);
            List <SubCopy> subCopys       = Obj_MyselfPlayer.GetMe().normalCopys;
            bool           isMainCopyOpen = true;
            foreach (SubCopy sub in subCopys)
            {
                if (sub.subCopyID == nextSubCopy)
                {
                    isMainCopyOpen = false;
                }
            }
            Tab_Copydetail nextSubDetail = TableManager.GetCopydetailByID(nextSubCopy);
            if (nextSubDetail == null) //如果获取下一副本不存在,要返回当前大副本小副本列表 可能发生在最后一个小副本
            {
                Debug.Log("No Next Copy [NextCopyDetail is Null]");
                GameObject go = this.transform.FindChild("PanelList/GridNormal/" + curMainCopyID.ToString()).gameObject;
                if (go != null)
                {
                    OnSelectMainCopy(go);
                }
                return;
            }
            Debug.Log("GetMe().curSubcopy.tblCopyDetail.Copyfather = " + Obj_MyselfPlayer.GetMe().curSubcopy.tblCopyDetail.Copyfather);
            if (nextSubDetail.Copyfather == Obj_MyselfPlayer.GetMe().curSubcopy.tblCopyDetail.Copyfather)
            {
                isMainCopyOpen = false;
            }
            if (!isMainCopyOpen) //没有大副本开启
            {
                Debug.Log("No Main Copy New Open");
                GameObject go = this.transform.FindChild("PanelList/GridNormal/" + curMainCopyID.ToString()).gameObject;
                if (go != null)
                {
                    OnSelectMainCopy(go);
                }
            }
            else
            {
                Tab_Copy nextMainCopy = TableManager.GetCopyByID(nextSubDetail.Copyfather);
                if (Obj_MyselfPlayer.GetMe().level >= nextMainCopy.PlayerLevel) //等级足够进入新大副本
                {
                    Debug.Log("Level is OK For New Main Copy -> UserLevel : " + Obj_MyselfPlayer.GetMe().level + " Need : " + nextMainCopy.PlayerLevel);
                    Debug.Log("GetMe().normalMainCopys.Count = " + Obj_MyselfPlayer.GetMe().normalMainCopys.Count);
                    foreach (MainCopy mainCopy in Obj_MyselfPlayer.GetMe().normalMainCopys)
                    {
                        if (mainCopy.copyId == nextSubDetail.Copyfather)
                        {
                            if (Obj_MyselfPlayer.GetMe().isNextMainOpened)
                            {
                                Debug.Log("NextMainOpened");
                                GameObject goCopy = this.transform.FindChild("PanelList/GridNormal/" + curMainCopyID.ToString()).gameObject;
                                if (goCopy != null)
                                {
                                    OnSelectMainCopy(goCopy);
                                }
                                return;
                            }
                            else if (mainCopy.copyId == 2) //如果是第二个大副本,并且是首次打开
                            {
                                Debug.Log("No.2 Main New Open");
                                if (GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.GIFT)
                                {
                                    GuideManager.Instance.isInSubStep = false;
                                }
                                logicTarget.SendMessage("ReturnToMainUI"); //首次打开第二大副本 返回主界面
                                return;
                            }
                            else
                            {
                                curMainCopyID++;
                            }
                            break;
                        }
                    }
                }
                Debug.Log("Level < Request || Other Main Copy New Open");
                Transform go = this.transform.FindChild("PanelList/GridNormal/" + curMainCopyID.ToString());
                if (go != null)
                {
                    OnSelectMainCopy(go.gameObject);
                }
            }
        }
    }
        private void InitPlayer()
        {
            //Init UI
            m_BattleTopUI      = BattleUI.Instacne.battleTopUI;
            m_AccelerateBtn    = BattleUI.Instacne.accelerateBtn;
            m_AutoForwardBtn   = BattleUI.Instacne.autoForwardBtn;
            m_BattleBackground = BattleUI.Instacne.battleBg;
            m_RoundCounter     = 1;

            for (int i = 0; i < 6; i++)
            {
                Obj_MyselfPlayer.GetMe().cardStates[i] = 0;
            }

            Obj_MyselfPlayer.GetMe().reviveCount = 0;

            SetBatttleData(Obj_MyselfPlayer.GetMe().battleData, Obj_MyselfPlayer.GetMe().lastBattleDrops);

            if (Obj_MyselfPlayer.GetMe().isGuideBattle)
            {
                m_RoundCounter = 3;
                m_AccelerateBtn.gameObject.SetActive(false);
                m_AutoForwardBtn.gameObject.SetActive(false);
            }
            else
            {
                switch (Obj_MyselfPlayer.GetMe().battleType)
                {
                case BattleType.PVP:
                case BattleType.QxzbPvP:
                    m_RoundCounter = 3;
                    m_AutoForwardBtn.gameObject.SetActive(false);
                    break;

                case BattleType.PVE:
                    m_AutoForwardBtn.gameObject.SetActive(true);
                    if (Obj_MyselfPlayer.GetMe().isAutoFowrard)
                    {
                        m_AutoForwardBtn.transform.FindChild("Sprite-AutoForward").GetComponent <UISprite>().spriteName = "zhandou_shoudongqianjin";
                    }
                    else
                    {
                        m_AutoForwardBtn.transform.FindChild("Sprite-AutoForward").GetComponent <UISprite>().spriteName = "zhandou_zidongqianjin";
                    }
                    m_BattleBackground.SetSubCopyID(Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID);
                    break;

                case BattleType.WORLD_BOSS:
                    m_AutoForwardBtn.gameObject.SetActive(false);
                    m_RoundCounter = 3;
                    break;

                case BattleType.CHONG_LOU:
                    m_AutoForwardBtn.gameObject.SetActive(true);
                    if (Obj_MyselfPlayer.GetMe().isAutoFowrard)
                    {
                        m_AutoForwardBtn.transform.FindChild("Sprite-AutoForward").GetComponent <UISprite>().spriteName = "zhandou_shoudongqianjin";
                    }
                    else
                    {
                        m_AutoForwardBtn.transform.FindChild("Sprite-AutoForward").GetComponent <UISprite>().spriteName = "zhandou_zidongqianjin";
                    }
                    break;
                }
                SetBattleAccelerate(Obj_MyselfPlayer.GetMe().acceleration);
            }

            //海外版,战斗加速逻辑修改;
            if (Obj_MyselfPlayer.GetMe().level >= 5 && !PlayerPrefs.HasKey("accelerateBtn" + Obj_MyselfPlayer.GetMe().accountID.ToString()))
            {
                m_AccelerateBtn.transform.FindChild("Sprite-Bg").gameObject.GetComponent <TweenAlpha>().enabled  = true;
                m_AccelerateBtn.transform.FindChild("Sprite-Num").gameObject.GetComponent <TweenAlpha>().enabled = true;
                m_AccelerateBtn.transform.FindChild("Sprite-X").gameObject.GetComponent <TweenAlpha>().enabled   = true;
            }

            //音乐逻辑需要修改
            if (Obj_MyselfPlayer.GetMe().isGuideBattle)
            {
                PlayBackgroundMusicRandom();
            }
            else
            {
                switch (Obj_MyselfPlayer.GetMe().battleType)
                {
                case BattleType.PVE:
                    Tab_Copydetail tab_detail = TableManager.GetCopydetailByID(Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID);
                    AudioManager.Instance.PlayBackgroundMusic(tab_detail.CopyMusic);
                    break;

                case BattleType.PVP:
                case BattleType.QxzbPvP:
                case BattleType.CHONG_LOU:
                    PlayBackgroundMusicRandom();
                    break;

                case BattleType.WORLD_BOSS:
                    Tab_Worldboss tab_worldBoss = TableManager.GetWorldbossByID(Obj_MyselfPlayer.GetMe().activeBoss.id);

                    if (tab_worldBoss == null)
                    {
                        Debug.LogError("world_boss id error");
                    }
                    else
                    {
                        AudioManager.Instance.PlayBackgroundMusic(tab_worldBoss.CopyMusic);
                    }
                    break;
                }
            }
        }