Exemplo n.º 1
0
    public void Update()
    {
        UpdateAttachMent();
        WeaponTableItem mWeaopnRes = DataManager.WeaponTable[mWeaponID] as WeaponTableItem;

        if (mCharacter != null)
        {
            mCharacter.transform.localEulerAngles = new Vector3(0, mRotateY, 0);

            mCharacter.transform.localPosition = mPos;
            mCharacter.transform.localScale    = Vector3.one * mScale;
            if (mVisual.AnimManager != null)
            {
                AnimatorStateInfo info = mVisual.AnimManager.Anim.GetCurrentAnimatorStateInfo((int)AnimationLayer.BaseLayer);
                if (Mathf.FloorToInt(info.normalizedTime) >= 1 && info.IsName(mStatename) && !info.IsName(DefaultCharacterAnim))
                {
                    PlayAnimaton(DefaultCharacterAnim);
                }

                if (mVisual.Visual.activeSelf == true && mInvalidAnim)
                {
                    mStatename = string.Empty;
                    PlayAnimaton(DefaultCharacterAnim);
                    mInvalidAnim = false;
                }
            }
        }
    }
Exemplo n.º 2
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="resid"></param>
    public void SetupWeapon(int resid)
    {
        if (!DataManager.WeaponTable.ContainsKey(resid))
        {
            return;
        }

        WeaponTableItem weaponTab = DataManager.WeaponTable[resid] as WeaponTableItem;

        if (weaponTab == null)
        {
            GameDebug.LogError(" WeaponTable没有找到武器 id = " + resid.ToString());
            return;
        }
        if (resid != mResid)
        {
            if (mWeapon != null)
            {
                mWeapon.Destroy();
            }
            mResid  = resid;
            mWeapon = new MeshVisual();
            mWeapon.CreateWithConfig(AssetConfig.WeaponPath + weaponTab.modelname, OnVisualSuccess, OnVisualFailed, false);
        }
    }
Exemplo n.º 3
0
    private void ProcessWeaponShow(ShowWeaponItem item)
    {
        //播放人物动作

        if (!string.IsNullOrEmpty(item.roleanim))
        {
            WeaponTableItem mWeaopnRes = DataManager.WeaponTable[mWeaponID] as WeaponTableItem;
            string          animname   = AnimationNameDef.GetAnimNameByStatename(mWeaopnRes.ani_pre, item.roleanim);
            PlayAnimaton(animname);
        }

        //播放武器动作
        if (!string.IsNullOrEmpty(item.weaponanim))
        {
            WeaponTableItem mWeaopnRes = DataManager.WeaponTable[mWeaponID] as WeaponTableItem;
            string          animname   = AnimationNameDef.WeaponPrefix + item.weaponanim;
            PlayWeaponAnimation(animname);
        }

        mShowEffect.Add(AttachEffect(item.effectid0, item.mountpoint0));
        mShowEffect.Add(AttachEffect(item.effectid1, item.mountpoint1));
        mShowEffect.Add(AttachEffect(item.effectid2, item.mountpoint2));
        foreach (uint id in mShowEffect)
        {
            ParticleItem pitem = SceneManager.Instance.GetCurScene().GetParticleManager().GetParticle(id);
            if (pitem == null)
            {
                continue;
            }
            pitem.Layer = layermask;
        }
    }
Exemplo n.º 4
0
    public int GetWeaponSkillID(int weaponid)
    {
        if (mWeaponSkillID >= 0 && mSuperWeapon == weaponid)
        {
            return(mWeaponSkillID);
        }

        if (!DataManager.WeaponTable.ContainsKey(weaponid))
        {
            return(-1);
        }

        WeaponTableItem wres = DataManager.WeaponTable[weaponid] as WeaponTableItem;


        if (!DataManager.WeaponSkillTable.ContainsKey(wres.take_skill))
        {
            return(-1);
        }

        WeaponSkillTableItem item = DataManager.WeaponSkillTable[wres.take_skill] as WeaponSkillTableItem;

        if (item == null)
        {
            return(-1);
        }

        mWeaponSkillID = item.skillid;
        mSuperWeapon   = weaponid;

        return(mWeaponSkillID);
    }
Exemplo n.º 5
0
    protected override ErrorCode doStart(ActionInitParam param)
    {
        ActionReloadInitParam reloadParam = (ActionReloadInitParam)(param);

        if (reloadParam == null)
        {
            return(ErrorCode.ConfigError);
        }

        mWeaponResID = reloadParam.weaponid;

        if (mWeaponResID < 0)
        {
            return(ErrorCode.ConfigError);
        }

        if (!DataManager.WeaponTable.ContainsKey(mWeaponResID))
        {
            GameDebug.LogError("ActionReload 未找到武器 id = " + mWeaponResID.ToString());
            return(ErrorCode.ConfigError);
        }

        WeaponTableItem item = DataManager.WeaponTable[mWeaponResID] as WeaponTableItem;

        mWaiting    = true;
        mWaitTime   = (int)item.reload_interval;
        mReloadTime = (int)item.reload_time;

        mOwner.AddActiveFlag(ActiveFlagsDef.DisableSkillUse, true, true);

        return(base.doStart(param));
    }
Exemplo n.º 6
0
    private void UpdateEquips()
    {
        PackageManager pack = mDataModule.GetPackManager();

        Dictionary <int, ItemObj> dic = pack.getPackDic(PackageType.Pack_Equip);

        for (int i = 0; i < (int)EquipSlot.EquipSlot_MAX; ++i)
        {
            if (dic.ContainsKey(i))
            {
                UpdateSingleEquip(i, dic[i]);
            }
            else
            {
                UpdateSingleEquip(i, null);
            }
        }

        PlayerDataModule module = ModuleManager.Instance.FindModule <PlayerDataModule>();

        if (module == null)
        {
            return;
        }

        int mainWeaponid = mDataModule.GetMainWeaponId();

        if (!DataManager.WeaponTable.ContainsKey(mainWeaponid))
        {
            return;
        }


        WeaponObj wobj = module.GetItemByID(mainWeaponid, PackageType.Pack_Weapon) as WeaponObj;

        if (wobj == null)
        {
            return;
        }
        WeaponTableItem res = DataManager.WeaponTable[mainWeaponid] as WeaponTableItem;

        UIAtlasHelper.SetButtonImage(mWeaponIcon, res.picname);
        mWeaponSterLv.text    = "+" + wobj.GetWeaponLv().ToString();
        mWeaponPromoteLv.text = wobj.GetPromoteLv().ToString();

        UIAtlasHelper.SetSpriteImage(mWeaponLvPic, wobj.GetWeaponLvPic());

        string zhishi = wobj.GetWeaponGradePic();

        if (string.IsNullOrEmpty(zhishi))
        {
            UIAtlasHelper.SetSpriteImage(mWeaponGradeBg, "common:weaponlvbg1");
        }
        else
        {
            UIAtlasHelper.SetSpriteImage(mWeaponGradeBg, "common:weaponlvbg2");
        }
        UIAtlasHelper.SetSpriteImage(mWeaponGradePic, zhishi);
    }
Exemplo n.º 7
0
    public override void Update()
    {
        UpdateAttachMent();
        WeaponTableItem mWeaopnRes = DataManager.WeaponTable[mWeaponID] as WeaponTableItem;

        if (mWeaopnRes != null)
        {
            mIdleTime += Time.fixedDeltaTime;
            if (mIdleTime >= GameConfig.CPPlayIdlePerTime)
            {
                if (DataManager.ShowWeaponTable.ContainsKey(mWeaopnRes.id))
                {
                    ShowWeaponItem showres  = DataManager.ShowWeaponTable[mWeaopnRes.id] as ShowWeaponItem;
                    string         animname = AnimationNameDef.GetAnimNameByStatename(mWeaopnRes.ani_pre, showres.roleanim);
                    PlayAnimaton(animname);

                    PlayWeaponAnimation("Base Layer." + showres.weaponanim);
                }
                mIdleTime = 0;
            }
        }



        if (mCharacter != null)
        {
            if (mCharacter.GetComponent <Renderer>() != null)
            {
                mCharacter.transform.localPosition = new Vector3(mPos.x, mPos.y - mCharacter.GetComponent <Renderer>().bounds.extents.y, mPos.z);
            }

            mCharacter.transform.localEulerAngles = new Vector3(0, mRotateY, 0);

            if (mVisual.AnimManager != null)
            {
                AnimatorStateInfo info = mVisual.AnimManager.Anim.GetCurrentAnimatorStateInfo((int)AnimationLayer.BaseLayer);
                if (Mathf.FloorToInt(info.normalizedTime) >= 1 && info.IsName(mStatename) && !info.IsName(DefaultCharacterAnim))
                {
                    PlayAnimaton(DefaultCharacterAnim);

                    if (mWeapon != null && mWeapon.AnimManager != null && mVisual.AnimManager.Anim != null)
                    {
                        PlayWeaponAnimation(AnimationNameDef.WeaponDefault);
                    }
                }

                if (mPreviewRoot.activeSelf == false)
                {
                    mInvalidAnim = true;
                }
                if (mPreviewRoot.activeSelf == true && mInvalidAnim)
                {
                    mStatename = string.Empty;
                    PlayAnimaton(DefaultCharacterAnim);
                    mInvalidAnim = false;
                }
            }
        }
    }
Exemplo n.º 8
0
    private bool checkWeapon()
    {
        DataType myName           = DataType.DATA_WEAPON;
        IDictionaryEnumerator itr = DataManager.WeaponTable.GetEnumerator();

        while (itr.MoveNext())
        {
            WeaponTableItem item = itr.Value as WeaponTableItem;
            if (item.upgrade < 0)
            {
                continue;
            }

            if (!DataManager.PromoteTable.ContainsKey((int)item.upgrade))
            {
                GameDebug.LogError("进阶ID为" + item.upgrade.ToString() + "不存在表格promote.txt中 ");
                return(false);
            }

            if (item.skill_1 >= 0)
            {
                SkillCommonTableItem fireSkill = DataManager.SkillCommonTable[item.skill_1] as SkillCommonTableItem;
                if (fireSkill == null)
                {
                    checkParam(false, myName, item.id, "射击技能 I", "未找到资源");
                    return(false);
                }

                if (!checkParam(fireSkill.isRegularAttack, DataType.DATA_SKILL_COMMON, fireSkill.resID, "是否为普通攻击", "武器技能必须标识为普通攻击"))
                {
                    return(false);
                }
            }

            if (item.skill_2 >= 0)
            {
                SkillCommonTableItem fireSkill2 = DataManager.SkillCommonTable[item.skill_2] as SkillCommonTableItem;
                if (fireSkill2 == null)
                {
                    checkParam(false, myName, item.id, "射击技能 II", "未找到资源");
                    return(false);
                }

                if (!checkParam(fireSkill2.isRegularAttack, DataType.DATA_SKILL_COMMON, fireSkill2.resID, "是否为普通攻击", "武器技能必须标识为普通攻击"))
                {
                    return(false);
                }
            }
        }
//      foreach (int key in DataManager.WeaponTable.Keys)
//      {
//
//      }

        return(true);
    }
Exemplo n.º 9
0
    /// <summary>
    /// 对玩家, 只改变模型; 其他单位模型和武器技能都被改变.
    /// </summary>
    public override bool ChangeWeapon(int weaponID)
    {
        if (!CanChangeWeapon() || mActiveFlagsContainer[ActiveFlagsDef.DisableChangeWeaponModel] != 0)
        {
            return(false);
        }

        if (weaponID == -1)
        {
            return(false);
        }

        //测试武器
        if (!DataManager.WeaponTable.ContainsKey(weaponID))
        {
            GameDebug.LogError(dbgGetIdentifier() + " not find weapon id=" + weaponID.ToString());
            return(false);
        }

        if (mWeaponAttach != null)
        {
            DetachVisual(mWeaponAttach);
            mWeaponAttach.visual.Destroy();
            mWeaponAttach = null;
        }
        RemoveAttach(AttachMountType.Weapon);
        if (mWeaponVisual != null)
        {
            mWeaponVisual.Destroy();
            mWeaponVisual = null;
        }

        if (mLastWeaponBuffID != uint.MaxValue)
        {
            ErrorHandler.Parse(
                RemoveSkillBuffByResID(mLastWeaponBuffID),
                "failed to remove skill buff on skill stopped"
                );
            mLastWeaponBuffID = uint.MaxValue;
        }

        mWeaopnRes = DataManager.WeaponTable[weaponID] as WeaponTableItem;

        mWeaponVisual = new MeshVisual();
        if (string.IsNullOrEmpty(mWeaopnRes.modelname))
        {
            onWeaponVisualSucess();
        }
        else
        {
            mWeaponVisual.CreateWithConfig(AssetConfig.WeaponPath + mWeaopnRes.modelname, onWeaponVisualSucess, onWeaponVisualFail, false);
        }

        return(true);
    }
Exemplo n.º 10
0
    private void OnWeaponSuccess()
    {
        if (mVisual == null || mVisual.Visual == null || mPreviewRoot == null)
        {
            return;
        }
        if (mWeapon == null || !mWeapon.IsCompleteOrDestroy)
        {
            return;
        }

        mVisual.VisualTransform.parent = mPreviewRoot.transform;


        WeaponTableItem mWeaopnRes = DataManager.WeaponTable[mWeaponID] as WeaponTableItem;

        Transform bone = mVisual.GetBoneByName(mWeaopnRes.mountpoint);

        if (bone == null)
        {
            bone = mVisual.VisualTransform;
        }
        mWeapon.Visual.layer = layermask;

        Renderer[] renders = mWeapon.Visual.GetComponentsInChildren <Renderer>();
        foreach (Renderer rd in renders)
        {
            rd.gameObject.layer = layermask;
            Material mtl = new Material(Shader.Find("Fantasy/ui/weapon"));
            mtl.mainTexture = rd.material.mainTexture;
            if (rd.material.shader.name == "FantasyEngine/weapon/environment")
            {
                mtl.SetTexture("_HightLightTex", rd.material.GetTexture("_HightLightTex"));
            }
            rd.material = mtl;
        }



        string animname = AnimationNameDef.GetAnimNameByStatename(mWeaopnRes.ani_pre, AnimationNameDef.PrefixXiuxi);

        PlayAnimaton(animname);

        //武器切换成功展现武器

        if (DataManager.ShowWeaponTable.ContainsKey(mWeaopnRes.id))
        {
            ShowWeaponItem showres = DataManager.ShowWeaponTable[mWeaopnRes.id] as ShowWeaponItem;
            ProcessWeaponShow(showres);
        }
    }
Exemplo n.º 11
0
    public void BuyWeapon(int id)
    {
        PlayerDataModule module = ModuleManager.Instance.FindModule <PlayerDataModule>();

        if (module == null)
        {
            return;
        }

        PrestigeTableItem preres = DataManager.PrestigeTable[id] as PrestigeTableItem;

        if (preres == null)
        {
            return;
        }

        uint pre = module.GetProceeds(ProceedsType.Money_Prestige);

        if (pre < preres.value)
        {
            PopTipManager.Instance.AddNewTip(StringHelper.GetString("presit_shortage"));
            return;
        }

        if (!DataManager.WeaponTable.ContainsKey(id))
        {
            GameDebug.LogError("无效的武器id:" + id.ToString());
            return;
        }

        WeaponTableItem res = DataManager.WeaponTable[id] as WeaponTableItem;

        uint gamei = module.GetProceeds(ProceedsType.Money_Game);

        if (gamei < (uint)res.gameprice)
        {
            PopTipManager.Instance.AddNewTip(StringHelper.GetString("money_game_shortage"));
            return;
        }

        //模拟服务器创建道具
        //module.CreateItemUnreal(id, PackageType.Pack_Weapon);
        BuyWeaponActionParam param = new BuyWeaponActionParam();

        param.WeaponResId = id;
        Net.Instance.DoAction((int)Message.MESSAGE_ID.ID_MSG_WD_BUY_WEAPON, param);
    }
Exemplo n.º 12
0
    private void OnWeaponSuccess()
    {
        if (mVisual == null || mVisual.Visual == null)
        {
            return;
        }
        if (mWeapon == null || !mWeapon.IsCompleteOrDestroy)
        {
            return;
        }

        WeaponTableItem mWeaopnRes = DataManager.WeaponTable[mWeaponID] as WeaponTableItem;

        Transform bone = mVisual.GetBoneByName(mWeaopnRes.mountpoint);

        if (bone == null)
        {
            bone = mVisual.VisualTransform;
        }

        string animname = AnimationNameDef.GetAnimNameByStatename(mWeaopnRes.ani_pre, AnimationNameDef.PrefixXiuxi);

        PlayAnimaton(animname);


        AttachMent attachment = mAttachMents[(int)AttachMountType.Weapon];

        if (attachment == null)
        {
            return;
        }

        if (mWeaopnRes.weapon_buff != uint.MaxValue)
        {
            SkillBuffTableItem sbt = DataManager.BuffTable[mWeaopnRes.weapon_buff] as SkillBuffTableItem;
            if (sbt != null)
            {
                ParticleUtility.AddEffect2MV(mWeapon, (int)sbt._3DEffectID, sbt._3DEffectBindpoint, ParticleMng);
            }
        }
    }
Exemplo n.º 13
0
    public void ChangeWeapon(int weaponid)
    {
        if (weaponid == mWeaponID)
        {
            return;
        }
        BehaviourUtil.StopCoroutine(ChangeWeapon_impl(mWeaponID));

        if (!DataManager.WeaponTable.ContainsKey(weaponid))
        {
            return;
        }


        if (mWeapon != null)
        {
            mWeapon.Destroy();
        }

        foreach (uint effectid in mShowEffect)
        {
            SceneManager.Instance.GetCurScene().GetParticleManager().RemoveParticle(effectid);
        }
        mShowEffect.Clear();
        mWeaponID = weaponid;
        //BehaviourUtil.StartCoroutine(ChangeWeapon_impl(weaponid));
        WeaponTableItem mWeaopnRes = DataManager.WeaponTable[weaponid] as WeaponTableItem;

        mWeapon = new MeshVisual();
        mWeapon.CreateWithConfig(AssetConfig.WeaponPath + mWeaopnRes.modelname, null, OnWeaponFailed, false);

        TransformData trans = new TransformData();

        trans.Rot   = new Vector3(90, 0, 0);
        trans.Scale = Vector3.one * mWeaopnRes.scale;

        ChangeAttach(AttachMountType.Weapon, mWeapon, mWeaopnRes.mountpoint, trans);
    }
Exemplo n.º 14
0
    private IEnumerator ChangeWeapon_impl(int weaponid)
    {
        WeaponTableItem mWeaopnRes = DataManager.WeaponTable[weaponid] as WeaponTableItem;

        if (mWeapon != null)
        {
            mWeapon.Destroy();
        }

        if (mWeaopnRes == null)
        {
            yield break;
        }

        while (mVisual == null || !mVisual.IsCompleteOrDestroy)
        {
            yield return(1);
        }

        mChangingWeaponID = weaponid;
        mWeapon           = new MeshVisual();
        mWeapon.CreateWithConfig(AssetConfig.WeaponPath + mWeaopnRes.modelname, OnWeaponSuccess, OnWeaponFailed, false);
    }
Exemplo n.º 15
0
    public override bool RunScript(RandEventArg argument)
    {
        StartRegularSkillEventArg regularSkillArg = argument as StartRegularSkillEventArg;
        Role            role        = mOwner as Role;
        int             weaponID    = role.GetMainWeaponID();
        WeaponTableItem weaponTable = (weaponID >= 0)
                        ? DataManager.WeaponTable[weaponID] as WeaponTableItem : null;

        //
        if (weaponTable == null)
        {
            return(ErrorHandler.Parse(ErrorCode.ConfigError, "武器ID[" + weaponID + "]不存在weapon.txt中, 加强buff将被移除"));
        }

        if (weaponTable.skill_2 < 0)
        {
            return(ErrorHandler.Parse(ErrorCode.ConfigError, "武器[" + weaponID + "]没有强化技能, 加强buff将被移除"));
        }

        regularSkillArg.SkillResID = (uint)weaponTable.skill_2;

        return(true);
    }
Exemplo n.º 16
0
    public string GetWeaponSkillIcon(int weaponid)
    {
        if (!DataManager.WeaponTable.ContainsKey(weaponid))
        {
            return("");
        }

        WeaponTableItem wres = DataManager.WeaponTable[weaponid] as WeaponTableItem;


        if (!DataManager.WeaponSkillTable.ContainsKey(wres.take_skill))
        {
            return("");
        }

        WeaponSkillTableItem item = DataManager.WeaponSkillTable[wres.take_skill] as WeaponSkillTableItem;

        if (item == null)
        {
            return("");
        }

        return(item.icon);
    }
Exemplo n.º 17
0
    private bool CheckItem()
    {
        //Hashtable map = null;

        IDictionaryEnumerator itr = DataManager.NormalItemTable.GetEnumerator();

        while (itr.MoveNext())
        {
            NormalItemTableItem norres = itr.Value as NormalItemTableItem;
            if (ItemManager.GetItemType((uint)norres.id) != ItemType.Normal)
            {
                GameDebug.LogError("道具ID非法。id = " + norres.id.ToString());
                return(false);
            }
        }
//         map = DataManager.NormalItemTable;
//         foreach (NormalItemTableItem norres in map.Values)
//         {
//             if(ItemManager.GetItemType((uint)norres.id) != ItemType.Normal)
//             {
//                 GameDebug.LogError("道具ID非法。id = " + norres.id.ToString());
//                 return false;
//             }
//         }
        itr = DataManager.DefenceTable.GetEnumerator();
        while (itr.MoveNext())
        {
            DefenceTableItem deres = itr.Value as DefenceTableItem;
            if (ItemManager.GetItemType((uint)deres.id) != ItemType.Defence)
            {
                GameDebug.LogError("装备ID非法。id = " + deres.id.ToString());
                return(false);
            }
        }
//         map = DataManager.DefenceTable;
//         foreach (DefenceTableItem deres in map.Values)
//         {
//
//         }
        itr = DataManager.WeaponTable.GetEnumerator();
        while (itr.MoveNext())
        {
            WeaponTableItem wres = itr.Value as WeaponTableItem;
            if (ItemManager.GetItemType((uint)wres.id) != ItemType.Weapon)
            {
                GameDebug.LogError("武器ID非法。id = " + wres.id.ToString());
                return(false);
            }
        }

//         map = DataManager.WeaponTable;
//         foreach (WeaponTableItem wres in map.Values)
//         {
//             if (ItemManager.GetItemType((uint)wres.id) != ItemType.Weapon)
//             {
//                 GameDebug.LogError("武器ID非法。id = " + wres.id.ToString());
//                 return false;
//             }
//         }
        itr = DataManager.BoxItemTable.GetEnumerator();
        while (itr.MoveNext())
        {
            BoxItemTableItem wres = itr.Value as BoxItemTableItem;
            if (ItemManager.GetItemType((uint)wres.id) != ItemType.Box)
            {
                GameDebug.LogError("箱子道具ID非法。id = " + wres.id.ToString());
                return(false);
            }
        }
//         map = DataManager.BoxItemTable;
//         foreach (BoxItemTableItem wres in map.Values)
//         {
//             if (ItemManager.GetItemType((uint)wres.id) != ItemType.Box)
//             {
//                 GameDebug.LogError("箱子道具ID非法。id = " + wres.id.ToString());
//                 return false;
//             }
//         }
        return(true);
    }
Exemplo n.º 18
0
    //界面打开
    protected override void OnOpen(object param = null)
    {
        EventDelegate.Add(mReturnBtn.onClick, OnReturnBtnClicked);

        PlayerDataModule module = ModuleManager.Instance.FindModule <PlayerDataModule>();

        if (module.GetQualifyingBestRank() == uint.MaxValue)
        {
            mNoBestRankText.text  = StringHelper.GetString("arena_outofrank");
            mNoBestRankText.alpha = 1.0f;
            mBestRankText.alpha   = 0.0f;
        }
        else
        {
            mBestRankText.text    = (module.GetQualifyingBestRank() + 1).ToString();
            mBestRankText.alpha   = 1.0f;
            mNoBestRankText.alpha = 0.0f;
        }

        mAwardText0.text = "X0";
        mAwardText1.text = "X0";

        QualifyingAwardTableItem res = mModule.GetCurAwardRes();

        if (res != null)
        {
            MoneyItemTableItem prestige = ItemManager.GetItemRes((int)res.mAwardPrestige) as MoneyItemTableItem;
            if (prestige != null && prestige.value > 0)
            {
                mAwardText1.text = "X" + prestige.value.ToString();
            }

            MoneyItemTableItem gold = ItemManager.GetItemRes((int)res.mAwardGold) as MoneyItemTableItem;
            if (gold != null && gold.value > 0)
            {
                mAwardText0.text = "X" + gold.value.ToString();
            }
        }

        uint money_prestige           = module.GetProceeds(ProceedsType.Money_Prestige);
        PrestigeTableItem mNextWeapon = new PrestigeTableItem();

        mNextWeapon.value = uint.MaxValue;

        IDictionaryEnumerator itr = DataManager.PrestigeTable.GetEnumerator();

        while (itr.MoveNext())
        {
            PrestigeTableItem item = itr.Value as PrestigeTableItem;

            if (item.value > money_prestige && item.value <= mNextWeapon.value)
            {
                if (item.value == mNextWeapon.value && item.sortid.CompareTo(mNextWeapon.sortid) > 0)
                {
                    continue;
                }
                mNextWeapon = item;
            }
        }

        if (mNextWeapon.value == uint.MaxValue)
        {
            mReputationText.text = StringHelper.GetString("qualifying_reputation2");
            mWeaponPanel.SetActive(false);
        }
        else
        {
            mReputationText.text = string.Format(StringHelper.GetString("qualifying_reputation"), mNextWeapon.value - money_prestige);
            mWeaponPanel.SetActive(true);
        }

        if (!DataManager.WeaponTable.ContainsKey(mNextWeapon.weaponid))
        {
            return;
        }

        WeaponTableItem weapon = DataManager.WeaponTable[mNextWeapon.weaponid] as WeaponTableItem;

        if (null == weapon)
        {
            return;
        }

        mWeaponNameText.text = weapon.name;
        UIAtlasHelper.SetSpriteImage(mWeaponPic, weapon.picname);
        mScrollBar.value = 0.0f;
    }
Exemplo n.º 19
0
    private void InitWeaponItemInfo()
    {
        PlayerDataModule module = ModuleManager.Instance.FindModule <PlayerDataModule>();

        if (null == module)
        {
            return;
        }
        WeaponObj mData = module.GetItemByID(uiparam.itemid, PackageType.Pack_Weapon) as WeaponObj;

        if (null == mData)
        {
            return;
        }
        WeaponTableItem item = DataManager.WeaponTable[uiparam.itemid] as WeaponTableItem;

        if (null == item)
        {
            return;
        }
        ConfigTableItem configitem = DataManager.ConfigTable[item.quality] as ConfigTableItem;

        if (null == configitem)
        {
            return;
        }
        PromoteTableItem pres = DataManager.PromoteTable[mData.GetPromoteLv() + item.upgrade] as PromoteTableItem;

        if (pres == null)
        {
            GameDebug.LogError("进阶promote.txt表格无此ID=" + mData.GetPromoteLv());
            return;
        }
        StrenTableItem stritem = DataManager.StrenTable[module.GetStrenLv()] as StrenTableItem;

        if (null == stritem)
        {
            return;
        }

        uint lv     = module.GetStrenLv();
        int  starlv = (int)(lv / STREN_STEP);

        if (starlv > 0 && (lv % STREN_STEP) == 0)
        {
            starlv -= 1;
        }
        uint showlv = lv == 0 ? 0 : (lv % STREN_STEP == 0 ? 10 : lv % STREN_STEP);

        for (uint i = 0; i < showlv; ++i)
        {
            SetIcon(mWeaponStrList[(int)i], "common:strenth (" + (starlv + 7) + ")");
        }

        for (uint i = showlv; i < STREN_STEP; ++i)
        {
            SetIcon(mWeaponStrList[(int)i], "common:starslvback");
        }

        mWeaponName.text       = "[" + configitem.value + "]" + item.name;
        mWeaponUseLv.text      = mData.GetPromoteLv() + "阶";
        mWeaponStrLv.text      = module.GetStrenLv() + "级";
        mWeaponBaseDamage.text = pres.value.ToString();
        mWeaponStrDamage.text  = stritem.value.ToString();
        mWeaponDesc.text       = item.desc;
        mWeaponAbtain.text     = item.desc0;
        mNumLb.text            = mData.GetPromoteLv().ToString();

        //SetIcon(mWeaponPic, item.picname);
    }