Exemplo n.º 1
0
        public void Init(int nVoteID, uint pdbID)
        {
            if (pdbID <= 0 || m_isInit)
            {
                return;
            }

            m_Pdbid = pdbID;

            m_isShowLabel = false;
            m_curLabel    = 0;

            // 获取点赞信息脚本
            SSchemeWarSupportPlayerConfig sConfig = WarSupportPlayerConfigPage.Instance.GetWarSupportPlayerConfig(nVoteID);

            if (sConfig == null)
            {
                return;
            }

            if (sConfig.labelIDList.Length != labelTextList.Length)
            {
                Debug.LogError("UI标签个数和配置表不一致");
                return;
            }

            for (int i = 0; i < labelTextList.Length; ++i)
            {
                Text label = labelTextList[i];
                if (label == null)
                {
                    continue;
                }

                // 根据标签ID获取标签信息
                int nLabelID = sConfig.labelIDList[i];
                SSchemeLabelConfig labelConfig = WarSupportPlayerConfigPage.Instance.GetLabelConfig(nLabelID);
                if (labelConfig == null)
                {
                    continue;
                }

                label.text = labelConfig.labelName;
            }

            m_curLabelList = sConfig.labelIDList;

            m_startPos = RectTransformUtility.WorldToScreenPoint(UISystem.Instance.GetCamera(), transform.position);

            m_LabelNum = labelTextList.Length;

            m_LabelAngler = 360f / m_LabelNum;

            m_isInit = true;

            if (StageManager.Instance.CurPermissionState == EStage_PermissionState.ESPS_OB)
            {
                gameObject.SetActive(false);
            }
        }
Exemplo n.º 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);
            }
        }