コード例 #1
0
 //设定操作的物品对象
 public void SetSlotItem(BackpackData data)
 {
     //背包index 和 slot数组的需要不同 index 从1开始 slot从0开始
     slotId    = GetIndex(data.index);
     equipSlot = data.itemData.equipPosition;
     oldEquip  = GetEquipData(equipSlot);
 }
コード例 #2
0
        /// <summary>
        /// 穿上装备
        /// </summary>
        /// <param name="result">Result.</param>
        void UseEquipNetworkResp(GCUserDressEquip result)
        {
            Log.Net("UseEquipNetworkResp " + result);
            if (oldEquip != null)
            {
                PopEquipData(equipSlot);
            }
            var ed = new EquipData(result.DressEquip);

            EquipmentData.Add(ed);

            if (result.HasPackEquip)
            {
                var newBagItem = new BackpackData(result.PackEquip);
                PutItemInBackpackIndex(newBagItem);
            }
            MyEventSystem.PushEventStatic(MyEvent.EventType.UpdateItemCoffer);

            //更新角色属性面板的装备信息
            //以及角色本身的装备信息
            var evt = new MyEvent(MyEvent.EventType.CharEquipChanged);

            evt.localID   = ObjectManager.objectManager.GetMyLocalId();
            evt.equipData = ed;
            evt.boolArg   = true;
            MyEventSystem.myEventSystem.PushEvent(evt);

            //通知角色属性面板 更新UI上面的icon
            evt = new MyEvent(MyEvent.EventType.RefreshEquip);
            MyEventSystem.myEventSystem.PushEvent(evt);
        }
コード例 #3
0
ファイル: PackageItem.cs プロジェクト: itcodes/unityRpg
 public void SetData(BackpackData data, int used = 0, bool showNum = true)
 {
     backpack = data;
     if (data.itemData.IsEquip())
     {
         Name.text = string.Format("[ff9500]{0}({1}级)[-]", data.GetTitle(), data.entry.Level);
     }
     else if (data.itemData.IsGem())
     {
         if (showNum)
         {
             Name.text = string.Format("[ff9500]{0}({1}阶)[-]\n[0098fc]数量:{2}[-]", data.GetTitle(), data.itemData.Level, data.num - used);
         }
         else
         {
             Name.text = string.Format("[ff9500]{0}({1}阶)[-]", data.GetTitle(), data.itemData.Level);
         }
     }
     else
     {
         if (showNum)
         {
             Name.text = string.Format("[ff9500]{0}[-]\n[0098fc]数量:{1}[-]", data.GetTitle(), data.num - used);
         }
         else
         {
             Name.text = string.Format("[ff9500]{0}[-]\n", data.GetTitle());
         }
     }
 }
コード例 #4
0
        public void PutInGem(BackpackData data)
        {
            var equipLevel = equip.entry.Level;
            var needLevel  = (equipLevel - 1) * 5;
            var myLev      = ObjectManager.objectManager.GetMyAttr().Level;

            if (myLev < needLevel)
            {
                WindowMng.windowMng.ShowNotifyLog(string.Format("只有自身达到{0}级,才能掌控更高级装备", needLevel));
                return;
            }

            var lev = data.itemData.Level;

            if (lev < equipLevel)
            {
                WindowMng.windowMng.ShowNotifyLog("此种神兵只有使用更高阶宝石方能炼化");
                return;
            }

            if (gems.Count >= 2)
            {
                WindowMng.windowMng.ShowNotifyLog("宝石已满,需要取下宝石才能放入新的!");
            }
            else
            {
                gems.Add(data);
                left.SetGems(gems);
                right.SetGems(gems);
            }
        }
コード例 #5
0
        /// <summary>
        ///只能卖出物品,暂时不支持装备
        /// ReduceItem AddGold
        /// </summary>
        public static void SellItem(BackpackData bd)
        {
            var sell = CGSellUserProps.CreateBuilder();

            sell.UserPropsId = bd.id;
            sell.GoodsType   = (int)bd.itemData.GetGoodsType();
            KBEngine.Bundle.sendImmediate(sell);
            WindowMng.windowMng.ShowNotifyLog(bd.itemData.ItemName + "-" + bd.num);
        }
コード例 #6
0
ファイル: GameInterface.cs プロジェクト: itcodes/unityRpg
        //将背包物品装备起来
        public void PacketItemUserEquip(BackpackData item)
        {
            //摆摊
            //验证使用规则
            //判断等级
            var myself = ObjectManager.objectManager.GetMyPlayer();

            if (myself != null)
            {
                if (item.GetNeedLevel() != -1 && myself.GetComponent <NpcAttribute>().Level < item.GetNeedLevel())
                {
                    var evt = new MyEvent(MyEvent.EventType.DebugMessage);
                    evt.strArg = "等级不够";
                    MyEventSystem.myEventSystem.PushEvent(evt);
                    return;
                }
            }

            BackPack.backpack.SetSlotItem(item);
            BackPack.backpack.StartCoroutine(BackPack.backpack.UseEquipForNetwork());
        }
コード例 #7
0
        public void PutInGem(BackpackData data)
        {
            var needLevel = data.itemData.Level * 5;
            var myLev     = ObjectManager.objectManager.GetMyAttr().Level;

            if (needLevel > myLev)
            {
                WindowMng.windowMng.ShowNotifyLog(string.Format("此种宝石需要自身达到{0}级,方能熔炼。", needLevel));
                return;
            }

            if (gems.Count >= 2)
            {
                WindowMng.windowMng.ShowNotifyLog("宝石已满,需要取下宝石才能放入新的!");
            }
            else
            {
                gems.Add(data);
                left.SetGems(gems);
                right.SetGems(gems);
            }
        }
コード例 #8
0
        /*
         * Initial Backpack Data From Network
         */
        void PutItemInBackpackIndex(int index, BackpackData bd)
        {
            Log.Sys("Backpack::PutItem From Network In backpack " + bd.packInfo);
            if (index >= SlotData.Count || index < 0)
            {
                //Debug.LogError ("BackPack:: index out of Range " + index);
                return;
            }
            int realIndex = GetIndex(index);

            if (SlotData [realIndex] != null && SlotData [realIndex].itemData != null)
            {
                //Debug.LogError ("BackPack:; has object in index " + realIndex);
                //return;
            }
            if (bd.num == 0)
            {
                SlotData [realIndex] = null;
            }
            else
            {
                SlotData [realIndex] = bd;
            }
        }
コード例 #9
0
 public void SetData(BackpackData bd)
 {
     backpackData = bd;
 }
コード例 #10
0
 void TakeOffGem(BackpackData data)
 {
     gems.Remove(data);
     left.SetGems(gems);
     right.SetGems(gems);
 }
コード例 #11
0
        /*
         * Put Item In Default Packet
         * 物品数量更新只从服务器接受报文更新 本地不更新
         */


        private void PutItemInBackpackIndex(BackpackData bd)
        {
            PutItemInBackpackIndex(bd.index, bd);
        }