예제 #1
0
        protected void Reposition()
        {
            if (_items == null || _items.Count <= 0)
            {
                return;
            }

            _splitAngle = 360f / transform.childCount;

            if (_offset > 360f)
            {
                _offset = _offset % 360f;
            }
            if (_offset < 0f)
            {
                _offset = _offset + 360f;
            }

            _index = Mathf.RoundToInt(_offset / _splitAngle);
            for (var i = 0; i < _items.Count; ++i)
            {
                var currentAngle = (_splitAngle * i + _offset + _snapAngle) % 360f;
                if (currentAngle >= 180f)
                {
                    currentAngle = currentAngle * _spaceRatio + _space;
                }
                else
                {
                    currentAngle *= _spaceRatio;
                }

                var t = Mathf.Abs((currentAngle + 180 - _snapAngle) % 360 - 180f) / 180f;
                UpdateItemEvent?.Invoke(_items[i], t);

                var pos = _items[i].RectTransform.anchoredPosition;
                pos.x = Mathf.Cos(currentAngle * Mathf.Deg2Rad) * _radius.x;
                pos.y = Mathf.Sin(currentAngle * Mathf.Deg2Rad) * _radius.y;
                _items[i].RectTransform.anchoredPosition = pos;
            }
        }
예제 #2
0
    public void UpdateItem(COM_Item item)
    {
        if (BagItems[item.slot_] == null)
        {
            return;
        }


        COM_Item bagItem = GetItemByInstId((int)item.instId_);

        if (bagItem != null)
        {
            ItemData iData     = ItemData.GetData((int)item.itemId_);
            string   itemName  = iData.name_;
            string   itemColor = "";
            if ((int)iData.quality_ >= (int)QualityColor.QC_Orange2)
            {
                itemColor = "fb851c";
            }
            if ((int)iData.quality_ <= (int)QualityColor.QC_White)
            {
                itemName = "";
            }
            else if ((int)iData.quality_ <= (int)QualityColor.QC_Green)
            {
                itemColor = "5efd52";
            }
            else if ((int)iData.quality_ <= (int)QualityColor.QC_Blue1)
            {
                itemColor = "4594ff";
            }
            else if ((int)iData.quality_ <= (int)QualityColor.QC_Purple2)
            {
                itemColor = "ad52fa";
            }
            else if ((int)iData.quality_ <= (int)QualityColor.QC_Golden2)
            {
                itemColor = "eef001";
            }
            else if ((int)iData.quality_ <= (int)QualityColor.QC_Orange2)
            {
                itemColor = "fb851c";
            }
            else if ((int)iData.quality_ <= (int)QualityColor.QC_Pink)
            {
                itemColor = "f66099";
            }



            int num    = bagItem.stack_;
            int curNum = num - item.stack_;
            if (curNum > 0)
            {
                if (!LotteryPanelUI.isOpen && !CompoundUI.isOpen)
                {
                    PopText.Instance.Show(LanguageManager.instance.GetValue("xiaohaoitemwupin").Replace("{n}", ItemData.GetData((int)item.itemId_).name_).Replace("{n1}", Mathf.Abs(curNum).ToString()), PopText.WarningType.WT_Tip, GamePlayer.Instance.isInBattle);
                }
                ChatSystem.PushSystemMessage(LanguageManager.instance.GetValue("xiaohaoitemwupin").Replace("{n}", ItemData.GetData((int)item.itemId_).name_).Replace("{n1}", Mathf.Abs(curNum).ToString()));
            }
            else if (curNum < 0)
            {
                if (!LotteryPanelUI.isOpen && !CompoundUI.isOpen)
                {
                    PopText.Instance.Show(LanguageManager.instance.GetValue("getitemwupin").Replace("{n}", ItemData.GetData((int)item.itemId_).name_).Replace("{n1}", Mathf.Abs(curNum).ToString()), PopText.WarningType.WT_None, false, itemColor);
                    //PopText.Instance.Show (LanguageManager.instance.GetValue("getitem").Replace("{n}", ItemData.GetData((int)item.itemId_).name_));
                }
                ChatSystem.PushSystemMessage(LanguageManager.instance.GetValue("getitemwupin").Replace("{n}", ItemData.GetData((int)item.itemId_).name_).Replace("{n1}", Mathf.Abs(curNum).ToString()));
            }
        }
        BagItems [item.slot_] = item;

        if (UpdateItemEvent != null)
        {
            UpdateItemEvent.Invoke(item);
        }
        isDirty_ = true;

        ItemData idata = ItemData.GetData((int)item.itemId_);

        if (idata == null)
        {
            return;
        }
        if (idata.mainType_ == ItemMainType.IMT_Consumables)
        {
            isUse = true;
            //ChatSystem.instance.AddchatInfo( LanguageManager.instance.GetValue("delitem").Replace("{n}",idata.name_),ChatKind.CK_System,false);
        }
        EmployessSystem.instance.UpdateEmployeeRed();
        QuestSystem.CheckItemQuest(item.itemId_);
        SoundTools.PlaySound(SOUND_ID.SOUND_HUODEWUQIN);
    }
예제 #3
0
 public void OnUpdateItem()
 {
     OnUpdate.Invoke(this);
 }