Ejemplo n.º 1
0
        public BattleCard(TroopMember member)
        {
            m_CardData            = new CardData();
            m_CardData.CardGuid   = member.guid;
            m_CardData.CardTempId = member.cardID;
            m_CardData.TotalHp    = member.initHp;
            m_CardData.MemberData = member;
            m_CurrentHp           = member.initHp;

            if (member.state == 1)
            {
                m_IsDead = true;
            }

            if (0 <= member.slotIndex && member.slotIndex <= 5)
            {
                m_CardType   = BattleCardType.E_BATTLE_CARD_TYPE_SELF;
                m_BattleSlot = BattleCardManager.Instance.BattleSlotArray[BattleCardType.E_BATTLE_CARD_TYPE_SELF][member.slotIndex];
            }
            else
            {
                m_CardType   = BattleCardType.E_BATTLE_CARD_TYPE_OTHER;
                m_BattleSlot = BattleCardManager.Instance.BattleSlotArray[BattleCardType.E_BATTLE_CARD_TYPE_OTHER][member.slotIndex - 6];
            }
            m_BattleSlot.SetCard(this);
            m_BattleSlot.SetTotalHp(member.initHp);
            m_BattleSlot.SetCurHp(member.initHp);

            m_StateMachine = new CardStateMachine(this);
        }
        public BattleCard CreateCard(TroopMember member)
        {
            BattleCard battle_card = new BattleCard(member);

            if (!battle_card.Init())
            {
                Debug.LogError("CreateCard");
                return(null);
            }
            if (!battle_card.PreLoad())
            {
                Debug.LogError("CreateCard");
                return(null);
            }
            battle_card.ChangeState(CardStateType.E_CARD_STATE_PREPARE);
            m_BattleCardList[battle_card.Card_Type].Add(battle_card);

            return(battle_card);
        }
Ejemplo n.º 3
0
        public override void Update()
        {
            m_DeltaTime += Time.deltaTime;
            if (m_DeltaTime >= m_TotalTime)
            {
                m_Manager.ChangProcedure(BattleProcedureType.E_BATTLE_PROCEDURE_CARD_FORWARD);
            }

            if (m_CopyPromptWidget != null && !m_CopyPromptWidget.activeInHierarchy)
            {
                TroopMember trmbr = m_Manager.GetBattlePlayer().GetBattleRoundData().FindCardByGUID(Obj_MyselfPlayer.GetMe().teamMemberArray[0]);
                m_CopyPromptWidget.GetComponent <CopyPromptUI>().Show(Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID, true, trmbr.cardID);
                m_TotalTime = 10f;
            }

            if (m_CopyPromptWidget == null || !m_CopyPromptWidget.activeSelf)
            {
                if (m_HetiPromptWidget != null && !m_HetiPromptWidget.activeInHierarchy)
                {
                    m_HetiPromptWidget.GetComponent <HeTiPromptUI>().Show(Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID);
                    m_TotalTime = 10f;
                }
            }
        }
        public override void OnEnter()
        {
            m_DeltaTime = 0f;

            //for guide
            if (Obj_MyselfPlayer.GetMe().isLastBattleNotFinish&& !GuideManager.Instance.isEnd())
            {
                Obj_MyselfPlayer.GetMe().isLastBattleNotFinish = false;
            }
            //end


            if (Obj_MyselfPlayer.GetMe().isGuideBattle)
            {
                Obj_MyselfPlayer.GetMe().battleData.isPlayed = false;
                Obj_MyselfPlayer.GetMe().isGuideBattle = false;
                GuideManager.Instance.FinishedStep(GuideManager.GUIDE_STEP.FIRST_COPY);
                Obj_MyselfPlayer.GetMe().OnBattleEnd();
                //LoadingSliderKit.AsycLoadScene(Utils.UI_NAME_main);
                GameManager.Instance.LoadLevel(Utils.UI_NAME_Login);
            }
            else
            {
                switch (Obj_MyselfPlayer.GetMe().battleType)
                {
                case BattleType.PVE:
                    if (m_Manager.GetBattlePlayer().GetBattleRoundData().isWin)
                    {
                        //副本后提示
                        string key       = "copy_back_" + Obj_MyselfPlayer.GetMe().accountID + "_" + Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID;
                        int    is_shown  = PlayerPrefs.GetInt(key, 0);
                        int    copy_text = TableManager.GetCopydetailByID(Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID).BackText;
                        if (is_shown != 1 && copy_text != -1)
                        {
                            GameObject copy_prompt_asset = Resources.Load("Widgets/CopyPromptUI", typeof(GameObject)) as GameObject;
                            GameObject copy_prompt       = GameObject.Instantiate(copy_prompt_asset) as GameObject;
                            GameObject anchor            = GameObject.Find("UI Root (2D)/Camera/Anchor/Panel/Anchor/Panel-Top");
                            copy_prompt.transform.parent        = anchor.transform;
                            copy_prompt.transform.localPosition = new Vector3(267f, -93f, -20f);
                            copy_prompt.transform.localScale    = new Vector3(1f, 1f, 1f);
                            copy_prompt.SetActive(false);
                            m_CopyPromptWidget = copy_prompt;
                            Debug.Log("Load Windows/CopyPromptUI");
                        }

                        if (m_CopyPromptWidget != null)
                        {
                            TroopMember trmbr = m_Manager.GetBattlePlayer().GetBattleRoundData().FindCardByGUID(Obj_MyselfPlayer.GetMe().teamMemberArray[0]);
                            m_CopyPromptWidget.GetComponent <CopyPromptUI>().Show(Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID, false, trmbr.cardID);

                            m_TotalTime = 10f;
                        }
                        else
                        {
                            NetworkSender.Instance().ClearBattleData(OnClearDataRet, Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID);
                        }
                    }
                    else
                    {
                        NetworkSender.Instance().ClearBattleData(OnClearDataRet, Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID);
                    }
                    break;

                case BattleType.PVP:
                case BattleType.QxzbPvP:
                    Obj_MyselfPlayer.GetMe().OnBattleEnd();
                    //LoadingSliderKit.AsycLoadScene(Utils.UI_NAME_main);
                    GameManager.Instance.LoadLevel(Utils.UI_NAME_main);
                    break;

                case BattleType.WORLD_BOSS:
                    Obj_MyselfPlayer.GetMe().SetUserBaseData(Obj_MyselfPlayer.GetMe().battleData.pbBaseData);
                    NetworkSender.Instance().RequestWorldBossInfo(OnClearDataRet);
                    break;

                case BattleType.CHONG_LOU:
                    NetworkSender.Instance().ClearPataBattleData(OnClearDataRet);
                    break;
                }
            }
        }