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
 void   ReadRoleData()
 {
     DataDBSBagItem.Read(GetDataPath(GTDataKey.Data_BagItems), EDataKeyType.Pos);
     DataDBSEquip.Read(GetDataPath(GTDataKey.Data_Equips), EDataKeyType.Instance);
     DataDBSDressEquip.Read(GetDataPath(GTDataKey.Data_DressEquips), EDataKeyType.Pos);
     DataDBSMoney.Read(GetDataPath(GTDataKey.Data_Moneys), EDataKeyType.Id);
     DataDBSAction.Read(GetDataPath(GTDataKey.Data_Actions), EDataKeyType.Id);
     DataDBSSoul.Read(GetDataPath(GTDataKey.Data_Souls), EDataKeyType.Id);
     DataDBSBagGem.Read(GetDataPath(GTDataKey.Data_BagGems), EDataKeyType.Pos);
     DataDBSGem.Read(GetDataPath(GTDataKey.Data_Gems), EDataKeyType.Instance);
     DataDBSDressGem.Read(GetDataPath(GTDataKey.Data_DressGems), EDataKeyType.Pos);
     DataDBSBagChip.Read(GetDataPath(GTDataKey.Data_BagChips), EDataKeyType.Pos);
     DataDBSBagFashion.Read(GetDataPath(GTDataKey.Data_BagFashions), EDataKeyType.Pos);
     DataDBSBagRune.Read(GetDataPath(GTDataKey.Data_BagRunes), EDataKeyType.Pos);
     DataDBSDressRune.Read(GetDataPath(GTDataKey.Data_DressRunes), EDataKeyType.Pos);
     DataDBSDressFashion.Read(GetDataPath(GTDataKey.Data_DressFashions), EDataKeyType.Pos);
     DataDBSRune.Read(GetDataPath(GTDataKey.Data_Runes), EDataKeyType.Instance);
     DataDBSCopy.Read(GetDataPath(GTDataKey.Data_Copys), EDataKeyType.Id);
     DataDBSMainChapter.Read(GetDataPath(GTDataKey.Data_MainChapters), EDataKeyType.Id);
     DataDBSRaid.Read(GetDataPath(GTDataKey.Data_Raid), EDataKeyType.Id);
     DataDBSPartner.Read(GetDataPath(GTDataKey.Data_Partners), EDataKeyType.Id);
     DataDBSMount.Read(GetDataPath(GTDataKey.Data_Mounts), EDataKeyType.Id);
     DataDBSRelics.Read(GetDataPath(GTDataKey.Data_Relics), EDataKeyType.Id);
     DataDBSPet.Read(GetDataPath(GTDataKey.Data_Pets), EDataKeyType.Id);
     DataDBSGuide.Read(GetDataPath(GTDataKey.Data_Guides), EDataKeyType.Id);
     DataDBSThreadTask.Read(GetDataPath(GTDataKey.Data_MainTasks), EDataKeyType.Id);
     DataDBSBranchTask.Read(GetDataPath(GTDataKey.Data_BranchTasks), EDataKeyType.Id);
     DataDBSDailyTask.Read(GetDataPath(GTDataKey.Data_DailyTasks), EDataKeyType.Id);
 }
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
    void   DumpRoleData()
    {
        DataDBSMoney.Clear();
        DataDBSAction.Clear();
        DataDBSSoul.Clear();

        DataDBSBagItem.Clear();
        DataDBSBagGem.Clear();
        DataDBSBagChip.Clear();
        DataDBSBagRune.Clear();
        DataDBSBagFashion.Clear();

        DataDBSDressEquip.Clear();
        DataDBSDressFashion.Clear();
        DataDBSDressGem.Clear();
        DataDBSDressRune.Clear();

        DataDBSEquip.Clear();
        DataDBSGem.Clear();
        DataDBSRune.Clear();
        DataDBSMainChapter.Clear();
        DataDBSCopy.Clear();
        DataDBSRaid.Clear();

        DataDBSRelics.Clear();
        DataDBSMount.Clear();
        DataDBSPartner.Clear();
        DataDBSPet.Clear();
        DataDBSGuide.Clear();

        DataDBSThreadTask.Clear();
        DataDBSBranchTask.Clear();
        DataDBSDailyTask.Clear();
    }
Esempio n. 5
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. 6
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. 7
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. 8
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. 9
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. 10
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);
                }
            }
        }
    }