예제 #1
0
        public void OnDestroy()
        {
            if (m_EffectObjList != null)
            {
                foreach (GameObject item in m_EffectObjList)
                {
                    GameObject temp = item;
                    if (item != null)
                    {
                        ResNode.DestroyRes(ref temp);
                    }
                }
            }

            VotePointImage.sprite = null;
            VotePointImage.gameObject.SetActive(false);

            TitleImage.sprite = null;
            TitleImage.gameObject.SetActive(false);

            VoteDescText.text   = "未配置";
            PlayerNameText.text = "";


            WarLabelSelectItem labelItem = VoteButton.GetComponent <WarLabelSelectItem>();

            labelItem.Clear();

            VoteButton.gameObject.SetActive(false);
        }
예제 #2
0
        public void SetData(cmd_update_support_vote_person data, int nPlayerCount)
        {
            if (data.uPDBIU <= 0)
            {
                return;
            }

            // 初始化标签轮盘
            WarLabelSelectItem labelItem = VoteButton.GetComponent <WarLabelSelectItem>();

            if (labelItem != null && labelItem.gameObject.activeSelf)
            {
                labelItem.Init(data.nVoteID, data.uPDBIU);
            }

            m_PDBIU = data.uPDBIU;

            // 计算玩家本次的点赞总数
            int nSupportNum = LogicDataCenter.labelDataManager.getPlayerSupportNum(m_PDBIU);

            if (parentsView)
            {
                VotePointImage.sprite = parentsView.GetSupportNumSprite(nSupportNum);
            }

            cmd_war_add_label lastLabel;
            int nLabelCount;
            // 当前玩家是否最新被点赞的玩家
            bool isLastPlayer = LogicDataCenter.labelDataManager.getLastPlayerLabel(m_PDBIU, out lastLabel, out nLabelCount);

            if (isLastPlayer)
            {
                // 播放标签特效
                loadLabelEffect(lastLabel, nLabelCount);
            }

            VotePointImage.SetNativeSize();
            VotePointImage.gameObject.SetActive(VotePointImage.sprite);
            SSchemeWarSupportPlayerConfig config = WarSupportPlayerConfigPage.Instance.GetWarSupportPlayerConfig(data.nVoteID);

            if (config != null)
            {
                VoteDescText.text = config.sVoteDesc;
                TitleImage.sprite = parentsView.GetSupportTitleSprite(config.nVoteIconID);
                TitleImage.gameObject.SetActive(TitleImage.sprite);
            }
            else
            {
                Debug.LogError(String.Format("GetWarSupportPlayerConfig failed. nVoteID={0},pdbid={1}", data.nVoteID, data.uPDBIU));
            }

            DataCenter.WarRecordTableDataManager.WarPersonInfo info = LogicDataCenter.recordTableDataManager.getWarPersonInfoByPDBID(data.uPDBIU);
            if (info == null)
            {
                return;
            }

            PlayerNameText.text = info.playerName;
            bool    bSameCamp     = info.nCamp == EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_CAMP);
            string  szColor       = bSameCamp ? "7BDBEDFF" : "FF3434FF";
            string  szEffectColor = bSameCamp ? "0072FF99" : "92000099";
            Color32 color         = ColorExtension.FromHex(szColor);
            Color32 effectcolor   = ColorExtension.FromHex(szEffectColor);

            PlayerNameText.color = color;
            PlayerNameText.gameObject.GetComponent <Outline>().effectColor = effectcolor;
            SSchemeWarSupportPositionConfig positionConfig = WarSupportPlayerConfigPage.Instance.GetWarSupportPositionConfig(data.nSortID, nPlayerCount);

            if (positionConfig == null)
            {
                return;
            }

            Vector3 oldAnchoredPosition = this.GetComponent <RectTransform>().anchoredPosition;

            this.GetComponent <RectTransform>().anchoredPosition = new Vector3(positionConfig.fUIPositionOffsetX, oldAnchoredPosition.y, oldAnchoredPosition.z);

            // 播放光效
            if (isLastPlayer)
            {
                DoEffect(m_PDBIU, bSameCamp, nSupportNum, data.nSortID);
            }

            // 播放音效
            if (isLastPlayer)
            {
                DoSound(nSupportNum);
            }
        }