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; } }
public IActionResult OnPostUpdate(int id, UpdateItemEvent updateItem) { if (!ModelState.IsValid) { return(Page()); } using (var tx = _session.BeginTransaction()) { var item = _session.Get <Item>(id); if (item != null) { item.Price = updateItem.Price; item.Description = updateItem.Description; _session.Update(item); } tx.Commit(); } return(RedirectToPage()); }
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); }
public void OnHandle(UpdateItemEvent message) { UpdateItem(message.Item); //var item = message.Item; //// TODO remove job ////if (message.JobFailed) ////{ //// // remove job sprite //// if (_fixedObjectGraphics.ContainsKey(item)) //// { //// var graphic = _fixedObjectGraphics[item]; //// Destroy(graphic); //// return; //// } ////} //// TODO improve - generic //bool rotate = false; //if (item.Type == Item.Door) //{ // // default door is EW // // it there is a wall to the north this is as NS door, so rotate // var north = IoC.Get<WorldController>().GetTile(item.Tile.Position.GetNorth()); // var south = IoC.Get<WorldController>().GetTile(item.Tile.Position.GetSouth()); // rotate = north?.Item?.Type == Item.Wall && south?.Item?.Type == Item.Wall; //} //if (message.UpdateOnly == false) //{ // GameObject graphic; // SpriteRenderer renderer; // if (!_itemGraphics.ContainsKey(item)) // { // graphic = new GameObject(); // graphic.name = $"{item.Type}_{item.Tile.Position}"; // graphic.transform.position = new Vector3(item.Tile.Position.x, item.Tile.Position.y); // if (rotate) // { // graphic.transform.rotation = Quaternion.Euler(0, 0, 90); // } // graphic.transform.SetParent(this.transform, true); // _itemGraphics.Add(item, graphic); // renderer = graphic.AddComponent<SpriteRenderer>(); // } // else // { // renderer = _itemGraphics[item].GetComponent<SpriteRenderer>(); // } // var spriteName = BuildItemSpriteName(item); // renderer.sprite = _resourceCollection.GetSprite(spriteName); // renderer.sortingLayerName = "FixedObjects"; // NotifyNeighbours(item); //} //else //{ // var renderer = _itemGraphics[item].GetComponent<SpriteRenderer>(); // var spriteName = BuildItemSpriteName(item); // renderer.sprite = _resourceCollection.GetSprite(spriteName); //} }