예제 #1
0
    // 发送当前页的加点数据
    public void CreateASTalentInfo(SSchemeTalentConfig talentInfo, out Value ASTalentValue)
    {
        string sEffectIdArray    = talentInfo.szTalentArray;
        string sTalentEffectDesc = "";

        if (sEffectIdArray != "")
        {
            string[] sTalentIdArray = ((string)(sEffectIdArray)).Split(';');
            int      nArrayLen      = sTalentIdArray.Length;

            for (int i = 0; i < nArrayLen; i++)
            {
                SSchemeTalentEffectConfig sTalentEffect = new SSchemeTalentEffectConfig();
                int nEffectArrayId = Convert.ToInt32(sTalentIdArray[i]);
                TalentPageEffect.Instance.GetTalentEffectInfo(nEffectArrayId, ref sTalentEffect);
                sTalentEffectDesc += sTalentEffect.szTalentDESC;
                if (i != nArrayLen - 1)
                {
                    sTalentEffectDesc += ";";
                }
            }
        }

        ASObjectEx ASTalentEx;

        ASTalentEx.names  = new string[] { "TalentID", "TalentName", "TalentIconID", "TalentType", "TalentLevel", "TalentAllowNum", "TalentMaxAddNum", "TalentEffectDesc" };
        ASTalentEx.values = new object[] { talentInfo.nId, talentInfo.szTalentName, talentInfo.nTalentIconId, talentInfo.nTalentType, talentInfo.nTalentLevel, talentInfo.nTalentAllowNum, talentInfo.nMaxAddNum, sTalentEffectDesc };
        ASTalentEx.types  = new Type[] { typeof(int), typeof(string), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(string) };
        ASTalentValue     = Value.ConvertToASObjectEx(ASTalentEx, this, "Com.Scaleform.Common.TalentInfo");
    }
예제 #2
0
    // 打包40个发送button基础属性数据发下去
    public void SetTalentButtonBaseInfo()
    {
        if (!Value.IsValueValid(TalentCenterPointFrame))
        {
            return;
        }

        Value     vAllTalentArray    = this.CreateArray();
        Hashtable allTalentPageTable = (TalentPage.Instance.GetAllTalentPageTable());

        //  Hashtable allTalentEffectTable = (TalentPageEffect.Instance.GetAllTalentEffectTable());
        vAllTalentArray.SetArraySize((uint)allTalentPageTable.Count);

        uint i = 0;

        foreach (int nTalentIdKey in allTalentPageTable.Keys)
        {
            Value ASTalentValue;
            SSchemeTalentConfig sTalentInfo = allTalentPageTable[nTalentIdKey] as SSchemeTalentConfig;
            CreateASTalentInfo(sTalentInfo, out ASTalentValue);
            vAllTalentArray.SetElement(i, ASTalentValue);
            i++;
        }

        if (TalentCenterPointFrame.Invoke("SetTalentButtonInfoAll", vAllTalentArray) == null)
        {
            Trace.LogError("call SetTalentButtonBaseInfo failed");
            return;
        }
    }
예제 #3
0
        public void SetNextTalentLimitDescChange(int nTalentId, int nTypePoints, int nLeftPoints)
        {
            SSchemeTalentConfig talentConfig = TalentPage.Instance.allTalentPageTable[nTalentId] as SSchemeTalentConfig;

            if (talentConfig == null)
            {
                return;
            }

            if (talentConfig.nTalentLevel == (int)TalentLevel.ENUM_TalentLevel_Max - 1)
            {
                return;
            }

            int nNextLevel = talentConfig.nTalentLevel;

            for (int j = 0; j < TalentPage.DefaultSameLevelCount; j++)
            {
                int nNextLevelTalentId = TalentPage.Instance.aTalentArray[talentConfig.nTalentType - 1, nNextLevel, j];
                if (nNextLevelTalentId == 0)
                {
                    continue;
                }

                GameObject talentObject = this.arrayTalentButton[nNextLevelTalentId - 1].gameObject;

                SSchemeTalentConfig talentNextConfig = TalentPage.Instance.allTalentPageTable[nNextLevelTalentId] as SSchemeTalentConfig;
                if (talentConfig == null)
                {
                    continue;
                }

                if (talentNextConfig.nTalentAllowNum < nTypePoints)
                {
                    continue;
                }
                // 加tip
                UTooltipTrigger tooltipTrigger = talentObject.GetComponent <UTooltipTrigger>();
                if (tooltipTrigger == null)
                {
                    continue;
                }

                string sTalentDesc = GetTalentDesc(nNextLevelTalentId, 0, nTypePoints, nLeftPoints, talentNextConfig);
                if (sTalentDesc == null || sTalentDesc == "")
                {
                    continue;
                }

                tooltipTrigger.SetText(UTooltipParamName.BodyText, sTalentDesc);
            }
        }
예제 #4
0
        public void showTalentButtonPoints(int nShowPoints, int nTalentId, int nTypePoints, int nLeftPoints)
        {
            Button talentButton = this.arrayTalentButton[nTalentId - 1];
            var    buttonText   = talentButton.transform.FindChild("Text").GetComponent <Text>();

            if (buttonText.text[2] == '5')
            {
                buttonText.text = nShowPoints.ToString() + "/" + "5";
            }
            else
            {
                buttonText.text = nShowPoints.ToString() + "/" + "1";
            }

            if (nShowPoints == 0)
            {
                talentButton.gameObject.GetComponent <Image>().AddNewMaterial(EUIShaderType.EST_Gray);
            }
            else
            {
                talentButton.gameObject.GetComponent <Image>().ResetToDefaultMaterial();
            }
            // tip
            UTooltipTrigger tooltipTrigger = talentButton.gameObject.GetComponent <UTooltipTrigger>();

            if (tooltipTrigger == null)
            {
                return;
            }

            SSchemeTalentConfig talentConfig = TalentPage.Instance.allTalentPageTable[nTalentId] as SSchemeTalentConfig;

            if (talentConfig == null)
            {
                return;
            }

            string sTalentDesc = GetTalentDesc(nTalentId, nShowPoints, nTypePoints, nLeftPoints, talentConfig);

            if (sTalentDesc == null || sTalentDesc == "")
            {
                return;
            }

            tooltipTrigger.SetText(UTooltipParamName.BodyText, sTalentDesc);
        }
예제 #5
0
        public void SetAllTalentLimitDescChange(Dictionary <int, int> dicAllTalentPoint, TalentChangePageModelInfo talentPageInfo)
        {
            int nButtonIndex = 0;

            foreach (int nTalentId in TalentPage.Instance.allTalentPageTable.Keys)
            {
                nButtonIndex++;
                if (dicAllTalentPoint.ContainsKey(nTalentId))
                {
                    if (dicAllTalentPoint[nTalentId] != 0)
                    {
                        continue;
                    }
                }

                GameObject talentObject = this.arrayTalentButton[nButtonIndex - 1].gameObject;

                SSchemeTalentConfig talentConfig = TalentPage.Instance.allTalentPageTable[nTalentId] as SSchemeTalentConfig;
                if (talentConfig == null)
                {
                    continue;
                }

                int nTypePoints = GetTypeAllPoints(talentConfig.nTalentType, talentPageInfo);
                if (talentConfig.nTalentAllowNum < nTypePoints)
                {
                    continue;
                }

                // 加tip
                UTooltipTrigger tooltipTrigger = talentObject.GetComponent <UTooltipTrigger>();
                if (tooltipTrigger == null)
                {
                    continue;
                }

                string sTalentDesc = GetTalentDesc(nTalentId, 0, nTypePoints, talentPageInfo.nLeftPoints, talentConfig);
                if (sTalentDesc == null || sTalentDesc == "")
                {
                    continue;
                }

                tooltipTrigger.SetText(UTooltipParamName.BodyText, sTalentDesc);
            }
        }
예제 #6
0
        public int CalculateReducePoint(int nTalentId, ref int nTalentType)
        {
            int nOldPoints = GetTalentPagePointsInfo(nTalentId);

            if (nOldPoints <= 0)
            {
                return(-1);
            }
            bool bCanReduce = true;
            SSchemeTalentConfig talentButtonInfo = allTalentButtonInfo[nTalentId] as SSchemeTalentConfig;

            if (talentButtonInfo.nTalentLevel != (int)(TalentLevel.ENUM_TalentLevel_Max - 1))      // 处理同类型的上一等级是否存在点数
            {
                int nNextLevel = talentButtonInfo.nTalentLevel + 1;
                for (int j = 0; j < TalentPage.DefaultSameLevelCount; j++)
                {
                    int nNextLevelTalentId = TalentPage.Instance.aTalentArray[talentButtonInfo.nTalentType - 1, nNextLevel - 1, j];
                    if (nNextLevelTalentId == 0)
                    {
                        continue;
                    }
                    int nNextLevelPoints = GetTalentPagePointsInfo(nNextLevelTalentId);
                    if (nNextLevelPoints > 0)
                    {
                        bCanReduce = false;
                        break;
                    }
                }
            }
            if (!bCanReduce)
            {
                return(-1);
            }
            nTalentType = talentButtonInfo.nTalentType;
            nOldPoints--;
            SetTalentPagePointsInfo(nTalentId, nOldPoints);
            SetTalentPageChange(true);
            SetOneTypeOverLayPoints(talentButtonInfo.nTalentType, -1);
            return(nOldPoints);
        }
예제 #7
0
        /////////////////////////////////////////////////////加点减点模块////////////////////////////////////////////////////////

        public int CalculateAddPoint(int nTalentId, ref int nTalentOutType)
        {
            if (!allTalentButtonInfo.ContainsKey(nTalentId))
            {
                return(0);
            }

            SSchemeTalentConfig talentButtonInfo = allTalentButtonInfo[nTalentId] as SSchemeTalentConfig;

            int nHasAddPoints = GetTalentPagePointsInfo(nTalentId);

            if (nHasAddPoints >= talentButtonInfo.nMaxAddNum)
            {
                return(0);
            }

            int nTalentType = talentButtonInfo.nTalentType;

            nTalentOutType = nTalentType;
            int nLimitCount = GetOneTypeOverLayPoints(nTalentType);

            // 前置天赋点数未达到要求
            if (nLimitCount < talentButtonInfo.nTalentAllowNum)
            {
                return(0);
            }

            int nTalentLevel = talentButtonInfo.nTalentLevel;

            // 由于是数组,效验长度
            if (nTalentType > TalentPage.DefaultTypeCount || nTalentType < 1 || nTalentLevel > TalentPage.DefaultLevelCount || nTalentLevel < 1)
            {
                UnityEngine.Debug.LogError("CalculateAddPoint: nTalentType or nTalentLevel is out of array");
                return(0);
            }

            // 以下逻辑处理加一点还是加5点
            // 要么是等级1的未加满加1点;要么是等级2的有加过点了加一点,2未加点直接加5点
            int nNeedAddPoint = 0;
            int nLeftTotalNum = GetTalentPageLeftTotalNum();//剩余可用点数

            if (nHasAddPoints > 0 || nTalentLevel % 2 == 0)
            {
                nNeedAddPoint = 1;
            }
            else
            {
                bool bHasPoint = false;

                for (int j = 0; j < TalentPage.DefaultSameLevelCount; j++)           // 判断加几点
                {
                    int nOtherTalentId = TalentPage.Instance.aTalentArray[nTalentType - 1, nTalentLevel - 1, j];
                    if (nOtherTalentId == 0 || nOtherTalentId == nTalentId)
                    {
                        continue;
                    }
                    int nOtherPoints = GetTalentPagePointsInfo(nOtherTalentId);
                    if (nOtherPoints != 0)
                    {
                        bHasPoint = true;
                        break;
                    }
                }

                if ((nTalentLevel % 2 != 0) && !bHasPoint)
                {
                    nNeedAddPoint = talentButtonInfo.nMaxAddNum;
                    if (nLeftTotalNum < nNeedAddPoint)
                    {
                        nNeedAddPoint = 1;
                    }
                }
                else
                {
                    nNeedAddPoint = 1;
                }
            }

            dicSameTypeLevelIdPoints.Clear();
            int  nLocalPoints   = nHasAddPoints + nNeedAddPoint;                //当前点击的天赋点数
            int  nOtherPoint    = 0;                                            //当前点击的同等级天赋点数
            bool bOtherHasPoint = false;

            for (int i = 0; i < TalentPage.DefaultSameLevelCount; i++)          // 处理其他点的减少
            {
                int nOtherTalentId = TalentPage.Instance.aTalentArray[nTalentType - 1, nTalentLevel - 1, i];
                if (nOtherTalentId == 0 || nOtherTalentId == nTalentId)
                {
                    continue;
                }
                int nOtherOldPoints = GetTalentPagePointsInfo(nOtherTalentId);
                if (nLeftTotalNum == 0)
                {
                    if (nOtherOldPoints == 0)
                    {
                        continue;
                    }
                    else
                    {
                        nOtherPoint    = nOtherOldPoints - nNeedAddPoint;
                        bOtherHasPoint = true;
                    }
                }
                else
                {
                    if (nLocalPoints + nOtherOldPoints >= talentButtonInfo.nMaxAddNum)
                    {
                        nOtherPoint = talentButtonInfo.nMaxAddNum - nLocalPoints;
                    }
                    else
                    {
                        // 未达到最大点数,不需要变动
                        continue;
                    }
                }

                if (nOtherOldPoints != nOtherPoint)
                {
                    // 有改变就要存
                    SetTalentPagePointsInfo(nOtherTalentId, nOtherPoint);
                    SetOneTypeOverLayPoints(nTalentType, nOtherPoint - nOtherOldPoints);
                    dicSameTypeLevelIdPoints[nOtherTalentId] = nOtherPoint;
                }
                nOtherPoint = 0;
            }

            if (nLeftTotalNum == 0 && !bOtherHasPoint)
            {
                nNeedAddPoint = 0;
            }
            else
            {
                SetTalentPagePointsInfo(nTalentId, nLocalPoints);
                SetOneTypeOverLayPoints(nTalentType, nNeedAddPoint);
                SetTalentPageChange(true);
            }

            return(nNeedAddPoint);
        }
예제 #8
0
        public string GetTalentDesc(int nTalentId, int nShowPoints, int nTypePoints, int nLeftPoints, SSchemeTalentConfig talentConfig)
        {
            int    nEffectId       = 0;
            int    nNextEffectId   = 0;
            string sTalentName     = talentConfig.szTalentName + "\n";
            string sLimitDesc      = "";
            string sLevelDesc      = "";
            string sCurTalentDesc  = "";
            string sNextTalentDesc = "";

            if (talentConfig.szTalentArray == "")
            {
                return(null);
            }

            string[] arrayEffectId = talentConfig.szTalentArray.Split(';');
            if (arrayEffectId.Length < nShowPoints)
            {
                return(null);
            }

            if (nShowPoints == 0)
            {
                sLimitDesc = GetLimitTalentDesc(talentConfig.nTalentAllowNum, talentConfig.nTalentType, nTypePoints, nLeftPoints);
            }

            if (nShowPoints != 0)
            {
                nEffectId = int.Parse(arrayEffectId[nShowPoints - 1]);
                SSchemeTalentEffectConfig talentEffectConfig = TalentPageEffect.Instance.allTalentEffectTable[nEffectId] as SSchemeTalentEffectConfig;
                if (talentEffectConfig == null)
                {
                    return(null);
                }

                sCurTalentDesc = talentEffectConfig.szTalentDESC;
                if (nShowPoints != talentConfig.nMaxAddNum)
                {
                    sCurTalentDesc += "\n";
                }
            }

            if (nShowPoints != talentConfig.nMaxAddNum)
            {
                nNextEffectId = int.Parse(arrayEffectId[nShowPoints]);
                SSchemeTalentEffectConfig talentEffectNextConfig = TalentPageEffect.Instance.allTalentEffectTable[nNextEffectId] as SSchemeTalentEffectConfig;
                if (talentEffectNextConfig == null)
                {
                    return(null);
                }

                if (nShowPoints == 0)
                {
                    sNextTalentDesc = talentEffectNextConfig.szTalentDESC;
                }
                else
                {
                    sNextTalentDesc = "下一級:" + talentEffectNextConfig.szTalentDESC;
                }
            }

            if (talentConfig.nTalentLevel % 2 == 0)
            {
                sLevelDesc = "等级;" + nShowPoints + "/1" + "\n";
            }
            else
            {
                sLevelDesc = "等级;" + nShowPoints + "/5" + "\n";
            }

            return(sTalentName + sLevelDesc + sLimitDesc + sCurTalentDesc + sNextTalentDesc);
        }
예제 #9
0
        ///////////////////////////////////按钮的主显示部分//////////////////////////////////////////
        // 切换页,新页显示控制 1、显示点 2、显示三类加点总和、3、显示页名
        public void SetOnePagePointView(TalentChangePageModelInfo talentPageInfo, Dictionary <int, int> dicAllTalentPoint)
        {
            int nButtonIndex = 0;

            foreach (int nTalentId in TalentPage.Instance.allTalentPageTable.Keys)
            {
                nButtonIndex++;
                GameObject talentObject = this.arrayTalentButton[nButtonIndex - 1].gameObject;
                var        buttonText   = talentObject.transform.FindChild("Text").GetComponent <Text>();

                int nShowPoints = 0;
                if (dicAllTalentPoint.ContainsKey(nTalentId))
                {
                    nShowPoints = dicAllTalentPoint[nTalentId];
                }
                if (buttonText.text[2] == '5')
                {
                    buttonText.text = nShowPoints.ToString() + "/" + "5";
                }
                else
                {
                    buttonText.text = nShowPoints.ToString() + "/" + "1";
                }

                // 置灰和颜色
                if (nShowPoints == 0)
                {
                    talentObject.GetComponent <Image>().AddNewMaterial(EUIShaderType.EST_Gray);
                }
                else
                {
                    talentObject.GetComponent <Image>().ResetToDefaultMaterial();
                }

                // 加tip
                UTooltipTrigger tooltipTrigger = talentObject.GetComponent <UTooltipTrigger>();
                if (tooltipTrigger == null)
                {
                    continue;
                }

                SSchemeTalentConfig talentConfig = TalentPage.Instance.allTalentPageTable[nTalentId] as SSchemeTalentConfig;
                if (talentConfig == null)
                {
                    continue;
                }

                int    nTypePoints = GetTypeAllPoints(talentConfig.nTalentType, talentPageInfo);
                string sTalentDesc = GetTalentDesc(nTalentId, nShowPoints, nTypePoints, talentPageInfo.nLeftPoints, talentConfig);
                if (sTalentDesc == null || sTalentDesc == "")
                {
                    continue;
                }

                tooltipTrigger.SetText(UTooltipParamName.BodyText, sTalentDesc);
            }

            this.SetThreeTypeNumShow(talentPageInfo.nAttackPointAll, talentPageInfo.nTrickPointAll, talentPageInfo.nHelpPointAll, talentPageInfo.nLeftPoints);
            this.SetNameShow(talentPageInfo.szTalentPageName);
            SetTopPageDescShow(talentPageInfo);
        }