Esempio n. 1
0
    public void TryChargeRelics(int relicsID, int index)
    {
        DRelics db = ReadCfgRelics.GetDataById(relicsID);

        if (db == null)
        {
            GTItemHelper.ShowTip("非法物品");
            return;
        }
        if (index > 3 || index < 1)
        {
            GTItemHelper.ShowTip("非法索引" + index.ToString());
            return;
        }
        XRelics relics = DataDBSRelics.GetDataById(relicsID);

        if (relics != null)
        {
            if (RelicsModule.Instance.GetExp(relics, index) >= db.LevelRequireExp[relics.Level])
            {
                GTItemHelper.ShowTip("你不能对此充能了");
                return;
            }
        }
        if (GTItemHelper.CheckItemEnongh(db.ArtificeCostID[index - 1], 1) == false)
        {
            return;
        }

        ReqChargeRelics req = new ReqChargeRelics();

        req.RelicsID = relicsID;
        req.Index    = index;
        NetworkManager.Instance.Send(MessageID.MSG_REQ_CHARGE_RELICS, req);
    }
Esempio n. 2
0
    private void ShowRelicsObj()
    {
        DRelics db = ReadCfgRelics.GetDataById(centerID);

        if (mRender == null)
        {
            mRender = ERender.AddRender(mModelTexture);
        }
        mRender.DelAllModels();
        mModel = mRender.AddModel(db.Model);
        if (mModel == null)
        {
            return;
        }
        mModel.SetActive(true);

        DStage ds = ReadCfgStageRelics.GetDataById(centerID);

        mModel.transform.localPosition    = new Vector3(ds.X, ds.Y, ds.Z);
        mModel.transform.localEulerAngles = new Vector3(0, 180, 0);
        mModel.transform.localScale       = Vector3.one;
        GameObject effect = GTWorld.Instance.Ect.LoadEffectObj(db.ActiveEffectID);

        if (effect == null)
        {
            return;
        }
        mRender.AddModel(effect);
        effect.transform.parent        = mModel.transform;
        effect.transform.localPosition = Vector3.zero;
        effect.transform.localRotation = Quaternion.identity;
        effect.transform.localScale    = Vector3.one;
    }
Esempio n. 3
0
    public void TryUpgradeRelics(int relicsID)
    {
        DRelics db = ReadCfgRelics.GetDataById(relicsID);

        if (db == null)
        {
            GTItemHelper.ShowTip("非法物品");
            return;
        }
        XRelics relics = DataDBSRelics.GetDataById(relicsID);

        if (relics == null)
        {
            GTItemHelper.ShowTip("非法物品");
            return;
        }
        if (relics.Level == db.LevelRequireExp.Length)
        {
            GTItemHelper.ShowTip("已升到最大等级,无法继续升级");
            return;
        }
        for (int i = 0; i < 3; i++)
        {
            if (RelicsModule.Instance.GetExp(relics, i + 1) < db.LevelRequireExp[relics.Level])
            {
                GTItemHelper.ShowTip("神器未获得足够的充能");
                return;
            }
        }
        ReqUpgradeRelics req = new ReqUpgradeRelics();

        req.RelicsID = relicsID;
        NetworkManager.Instance.Send(MessageID.MSG_REQ_UPGRADE_RELICS, req);
    }
Esempio n. 4
0
    private void ShowCurrRelicsView1()
    {
        DRelics db     = ReadCfgRelics.GetDataById(centerID);
        XRelics relics = DataDBSRelics.GetDataById(centerID);

        relicsName.text = (relics == null) ? db.Name : GTTools.Format("{0}  +{1}", db.Name, relics.Level);
        relicsDesc.text = db.Desc.ToString();
    }
Esempio n. 5
0
    private void ShowCurrRelicsView2()
    {
        int     targetID = mCards[mCenterIndex].id;
        DRelics db       = ReadCfgRelics.GetDataById(targetID);
        XRelics relics   = DataDBSRelics.GetDataById(targetID);

        for (int i = 0; i < mRelicsCharges.Count; i++)
        {
            RelicsCharge tab    = mRelicsCharges[i];
            int          itemID = db.ArtificeCostID[i];
            DItem        itemDB = ReadCfgItem.GetDataById(itemID);
            GTItemHelper.ShowItemName(tab.itemName, itemID);
            GTItemHelper.ShowItemTexture(tab.itemTexture, itemID);
            GTItemHelper.ShowItemQuality(tab.itemQuality, itemID);
            tab.itemNum.text = GTTools.Format("当前拥有:[d96016]{0}[-]", GTDataManager.Instance.GetItemCountById(itemID));
            tab.tip.text     = GTTools.Format("充能一次加 [d96916]{0}[-] 点经验", itemDB.Data1);

            if (relics == null)
            {
                tab.chargeProgressValue.value = 0;
                tab.chargeProgressNum.text    = GTTools.Format("{0}/{1}", 0, db.LevelExp[0]);
            }
            else
            {
                int curExp = 0;
                switch (i + 1)
                {
                case 1:
                    curExp = relics.CurExp1;
                    break;

                case 2:
                    curExp = relics.CurExp2;
                    break;

                case 3:
                    curExp = relics.CurExp3;
                    break;
                }

                int maxExp = db.LevelExp[relics.Level];
                GTItemHelper.ShowProgressSlider(tab.chargeProgressValue, curExp, maxExp);
                tab.chargeProgressNum.text = GTTools.Format("{0}/{1}", curExp, maxExp);
            }

            int index = i + 1;
            UIEventListener.Get(tab.btn).onClick = delegate(GameObject go)
            {
                GTAudioManager.Instance.PlayEffectAudio(GTAudioKey.SOUND_UI_CLICK);
                GTNetworkSend.Instance.TryChargeRelics(targetID, index);
            };
        }
    }
Esempio n. 6
0
    private void ShowButtonsState()
    {
        DRelics db         = ReadCfgRelics.GetDataById(centerID);
        XRelics relics     = DataDBSRelics.GetDataById(centerID);
        bool    canUpgrade = true;

        if (relics != null)
        {
            for (int i = 0; i < 3; i++)
            {
                int curExp = 0;
                switch (i + 1)
                {
                case 1:
                    curExp = relics.CurExp1;
                    break;

                case 2:
                    curExp = relics.CurExp2;
                    break;

                case 3:
                    curExp = relics.CurExp3;
                    break;
                }
                if (curExp < db.LevelExp[relics.Level])
                {
                    canUpgrade = false;
                }
            }
        }
        else
        {
            canUpgrade = false;
        }
        GTItemHelper.ShowImageBlack(btnUpgrade.transform.GetComponent <UISprite>(), !canUpgrade);


        XCharacter role = GTGlobal.Main;

        btnBattle.SetActive(role.Relic != centerID);
        btnUnload.SetActive(role.Relic == centerID);
    }
Esempio n. 7
0
    private void OnAck_UpgradeRelics(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        AckUpgradeRelics       ack = Serializer.Deserialize <AckUpgradeRelics>(ms);


        DRelics db     = ReadCfgRelics.GetDataById(ack.RelicsID);
        XRelics relics = DataDBSRelics.GetDataById(ack.RelicsID);

        relics.Level++;
        relics.CurExp1 = relics.CurExp1 - db.LevelExp[relics.Level - 1];
        relics.CurExp2 = relics.CurExp2 - db.LevelExp[relics.Level - 1];
        relics.CurExp3 = relics.CurExp3 - db.LevelExp[relics.Level - 1];
        DataDBSRelics.Update(ack.RelicsID, relics);

        GTWorld.Instance.SyncMainPlayerData(ESyncDataType.TYPE_BASEATTR);
        GTEventCenter.FireEvent(GTEventID.TYPE_RELICS_UPGRADE, ack.RelicsID);
        GTEventCenter.FireEvent(GTEventID.TYPE_CHANGE_FIGHTVALUE);
    }
Esempio n. 8
0
    public void TryUnloadRelics(int relicsID)
    {
        DRelics db = ReadCfgRelics.GetDataById(relicsID);

        if (db == null)
        {
            GTItemHelper.ShowTip("非法物品");
            return;
        }
        XCharacter role = RoleModule.Instance.GetCurPlayer();

        if (role.Relic != relicsID)
        {
            GTItemHelper.ShowTip("该神器没有上阵,无法卸下");
            return;
        }
        ReqUnloadRelics req = new ReqUnloadRelics();

        req.RelicsID = relicsID;
        NetworkManager.Instance.Send(MessageID.MSG_REQ_UNLOAD_RELICS, req);
    }
Esempio n. 9
0
    public void TryBattleRelics(int relicsID)
    {
        DRelics db = ReadCfgRelics.GetDataById(relicsID);

        if (db == null)
        {
            GTItemHelper.ShowTip("非法物品");
            return;
        }
        XCharacter role = RoleModule.Instance.GetCurPlayer();

        if (role.Relic == relicsID)
        {
            GTItemHelper.ShowTip("该神器已经上阵");
            return;
        }

        ReqBattleRelics req = new ReqBattleRelics();

        req.RelicsID = relicsID;
        NetworkManager.Instance.Send(MessageID.MSG_REQ_BATTLE_RELICS, req);
    }
Esempio n. 10
0
    private void OnAck_ChargeRelics(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        AckChargeRelics        ack = Serializer.Deserialize <AckChargeRelics>(ms);
        int index    = ack.Index;
        int relicsID = ack.RelicsID;

        DRelics db     = ReadCfgRelics.GetDataById(relicsID);
        int     itemID = db.ArtificeCostID[index - 1];
        DItem   itemDB = ReadCfgItem.GetDataById(itemID);
        XRelics relics = DataDBSRelics.GetDataById(relicsID);

        if (relics == null)
        {
            relics    = new XRelics();
            relics.Id = relicsID;
        }
        switch (index)
        {
        case 1:
            relics.CurExp1 += itemDB.Data1;
            break;

        case 2:
            relics.CurExp2 += itemDB.Data1;
            break;

        case 3:
            relics.CurExp3 += itemDB.Data1;
            break;
        }

        DataDBSRelics.Update(relicsID, relics);
        GTDataManager.Instance.UseItemById(itemID);

        GTWorld.Instance.SyncMainPlayerData(ESyncDataType.TYPE_BASEATTR);
        GTEventCenter.FireEvent(GTEventID.TYPE_RELICS_CHARGE, relicsID, index);
        GTEventCenter.FireEvent(GTEventID.TYPE_CHANGE_FIGHTVALUE);
    }
Esempio n. 11
0
    private void ShowPropertyView()
    {
        DRelics db     = ReadCfgRelics.GetDataById(centerID);
        XRelics relics = DataDBSRelics.GetDataById(centerID);

        for (int i = 0; i < 3; i++)
        {
            RelicsProperty tab1       = mNowPropertys[i];
            RelicsProperty tab2       = mNexPropertys[i];
            DProperty      propertyDB = ReadCfgProperty.GetDataById(db.PropertyID[i]);
            tab1.propertyName.text = propertyDB.Name;
            tab2.propertyName.text = propertyDB.Name.ToString();

            float ratio1 = 1;
            float ratio2 = ratio1 * (20 / 100f + 1);
            float num1   = 0;
            float num2   = 0;

            if (relics == null)
            {
                num1 = ratio1 * db.PropertyNum[i];
                num2 = ratio2 * db.PropertyNum[i];
                if (propertyDB.IsPercent)
                {
                    tab1.propertyNum.text = "+" + (num1 / 100f).ToPercent();
                    tab2.propertyNum.text = "+" + (num2 / 100f).ToPercent();
                }
                else
                {
                    tab1.propertyNum.text = "+" + ((int)num1).ToString();
                    tab2.propertyNum.text = "+" + ((int)num2).ToString();
                }
            }
            else
            {
                ratio1 = Mathf.Pow(20 / 100f + 1, relics.Level + 1);
                ratio2 = ratio1 * (20 / 100f + 1);

                num1 = (db.PropertyNum[i] * ratio1);
                num2 = (db.PropertyNum[i] * ratio2);

                if (relics.Level == db.LevelExp.Length)
                {
                    if (propertyDB.IsPercent)
                    {
                        tab1.propertyNum.text = "+" + (num1 / 100f).ToPercent();
                        tab2.propertyNum.text = string.Empty;
                    }
                    else
                    {
                        tab1.propertyNum.text = "+" + ((int)num1).ToString();
                        tab2.propertyNum.text = string.Empty;
                    }

                    nowAttr.transform.localPosition = new Vector3(100, -50, 0);
                    nexAttr.SetActive(false);
                    attrRow.SetActive(false);
                }
                else
                {
                    if (propertyDB.IsPercent)
                    {
                        tab1.propertyNum.text = "+" + (num1 / 100f).ToPercent();
                        tab2.propertyNum.text = "+" + (num2 / 100f).ToPercent();
                    }
                    else
                    {
                        tab1.propertyNum.text = "+" + ((int)num1).ToString();
                        tab2.propertyNum.text = "+" + ((int)num2).ToString();
                    }
                    nexAttr.SetActive(true);
                    attrRow.SetActive(true);
                    nowAttr.transform.localPosition = new Vector3(-20, -60, 0);
                    nexAttr.transform.localPosition = new Vector3(200, -60, 0);
                }
            }
        }
    }