Exemple #1
0
 //检测装备槽位(手动)
 public void Wear(int slot, Bagitem bagitem)
 {
     if (bagitem.item.Itemtype == ItemType.Equipments)
     {
         Equip equip = (Equip)bagitem.item;
         if (equip.Equiptype.Equals(_slot[slot]))
         {
             if (onwear[slot] != null)
             {
                 BackToBag(slot);
                 onwear[slot] = equip;
             }
             else
             {
                 onwear[slot] = equip;
             }
             onwear[slot].UseItem();
             CenterControl.Centerctrl.Refresh();
         }
         else
         {
             PlayerData.Player.PlayerBag.getItem(bagitem.item, bagitem.num);
             //返回提示不符合
             Debug.Log("不是该处装备");
         }
     }
     else
     {
         PlayerData.Player.PlayerBag.getItem(bagitem.item, bagitem.num);
         Debug.Log("这不是装备");
     }
 }
Exemple #2
0
        /*public void WearEquipment()
         * {
         *
         *  Debug.Log("鼠标装备了槽位"+CenterControl.Centerctrl.Intervalplace);
         *  if (CenterControl.Centerctrl.OnMouse != null)
         *  {
         *      Debug.Log("鼠标拖动不为空:" + CenterControl.Centerctrl.OnMouse.item.Objindex.Name);
         *      if (CenterControl.Centerctrl.Intervalplace < 0)
         *      {
         *          if (CenterControl.Centerctrl.OnMouse.item.Itemtype == ItemType.Equipments)
         *          {
         *              Debug.Log("拖动的是装备");
         *              PlayerData.Player.PlayerEquipment.Wear(-(CenterControl.Centerctrl.Intervalplace+1),(Equip)CenterControl.Centerctrl.OnMouse.item);
         *          }
         *          else
         *          {
         *              //提示不是装备
         *              Debug.Log("拖动的不是装备,退回");
         *              CenterControl.Centerctrl.Intervalplace = 99;
         *              PlayerData.Player.PlayerBag.getItem(CenterControl.Centerctrl.OnMouse.item,CenterControl.Centerctrl.OnMouse.num);
         *          }
         *      }
         *      else
         *      {
         *          Debug.Log("放置错误,退回");
         *          CenterControl.Centerctrl.Intervalplace = 99;
         *          PlayerData.Player.PlayerBag.getItem(CenterControl.Centerctrl.OnMouse.item,CenterControl.Centerctrl.OnMouse.num);
         *      }
         *      MouseFollowUi.SetActive(false);
         *      _areaCheck = false;
         *      CenterControl.Centerctrl.Refresh();
         *  }
         *
         * }*/

        public void ChooseItem()
        {
            //执行贴图赋给鼠标的函数
            Debug.Log("将当前物品附着鼠标上");

            if (_dragOver < 0)
            {
                Debug.Log("提取装备" + PlayerData.Player.PlayerEquipment.onwear[Bag2Equip(_dragOver)].Objindex.Name);
                //CenterControl.Centerctrl.OnMouse = new Bagitem();
                _wearOnMouse      = new Bagitem();
                _wearOnMouse.num  = 1;
                _wearOnMouse.item = PlayerData.Player.PlayerEquipment.onwear[Bag2Equip(_dragOver)];

                CenterControl.Centerctrl.OnMouse = _wearOnMouse;

                PlayerData.Player.PlayerEquipment.onwear[Bag2Equip(_dragOver)] = null;
            }
            else
            {
                Debug.Log("提取物品" + PlayerData.Player.PlayerBag.Listshow[_dragOver].item.Objindex.Name + PlayerData.Player.PlayerBag.Listshow[_dragOver].num + "个");
                CenterControl.Centerctrl.OnMouse = PlayerData.Player.PlayerBag.Listshow[_dragOver];

                /*CenterControl.Centerctrl.OnMouse.item = PlayerData.Player.PlayerBag.Listshow[CenterControl.Centerctrl.Intervalplace].item;
                 * CenterControl.Centerctrl.OnMouse.num =
                 *  PlayerData.Player.PlayerBag.Listshow[CenterControl.Centerctrl.Intervalplace].num;
                 * PlayerData.Player.PlayerBag.listonshow.RemoveAt(PlayerData.Player.PlayerBag.Page2Num(CenterControl.Centerctrl.Intervalplace));*/
            }
            SetMouseFollowUIActive(true);
        }
Exemple #3
0
        public void PullDownItem()
        {
            if (CenterControl.Centerctrl.OnMouse.item != null)
            {
                if (CenterControl.Centerctrl.Intervalplace < 0)
                {
                    Debug.Log("在装备松开");
                    //在装备松开
                    Bagitem temp = new Bagitem();
                    temp = CenterControl.Centerctrl.OnMouse;

                    PlayerData.Player.PlayerBag.listonshow.Remove(CenterControl.Centerctrl.OnMouse);
                    PlayerData.Player.PlayerEquipment.Wear(Bag2Equip(CenterControl.Centerctrl.Intervalplace), temp);
                    if (_dragOver < 0)
                    {
                        PlayerData.Player.PlayerEquipment.onwear[Bag2Equip(_dragOver)] = null;
                    }
                    CenterControl.Centerctrl.OnMouse = null;

                    /*
                     * else
                     * {
                     *  Debug.Log("背包源" + PlayerData.Player.PlayerBag.listonshow[PlayerData.Player.PlayerBag.Page2Num(_dragOver)].item.Objindex.Name + PlayerData.Player.PlayerBag.listonshow[PlayerData.Player.PlayerBag.Page2Num(_dragOver)].num);
                     *  Debug.Log("清除后背包源" + PlayerData.Player.PlayerBag.listonshow[PlayerData.Player.PlayerBag.Page2Num(_dragOver)].item.Objindex.Name + PlayerData.Player.PlayerBag.listonshow[PlayerData.Player.PlayerBag.Page2Num(_dragOver)].num);
                     * }*/
                    InitSpecialUI();
                    //PlayerData.Player.PlayerBag.getItem(CenterControl.Centerctrl.OnMouse.item,1);
                }
                else if (CenterControl.Centerctrl.Intervalplace < 99)
                {
                    //在背包松开
                    Debug.Log("收回物品" + CenterControl.Centerctrl.OnMouse.item.Objindex.Name);
                    if (_dragOver < 0)
                    {
                        PlayerData.Player.PlayerBag.getItem(CenterControl.Centerctrl.OnMouse.item, CenterControl.Centerctrl.OnMouse.num);
                        CenterControl.Centerctrl.OnMouse = null;
                    }

                    InitOnMouse();
                }
                else if (CenterControl.Centerctrl.Intervalplace == 99)
                {
                    if (_dragOver < 0)
                    {
                        PlayerData.Player.PlayerBag.getItem(CenterControl.Centerctrl.OnMouse.item, CenterControl.Centerctrl.OnMouse.num);
                        CenterControl.Centerctrl.OnMouse = null;
                    }
                    else if (CenterControl.Centerctrl.OnMouse.item.Itemtype != ItemType.Equipments)
                    {
                        Debug.Log("丢的不是装备");
                        InputNumUiPopup(false);
                    }
                    else
                    {
                        ThrowItem(1);
                    }
                }
            }
            TotalInit();
            _isOnDrag = false;
            _dragOver = 999;

            CenterControl.Centerctrl.Refresh();
        }