protected override void ProtectedAddUnsync(SordType sordType) { String key = Convert.ToString(sordType.id); ItemObj <SordType> item = makeItemObj(sordType); ProtectedPutUnsync(key, item); }
public async Task <IActionResult> CadastrarItemAsync([FromForm] ItemObj itemObj) { try { //TODO - Criar uma configuração para guardar esta informação client.BaseAddress = new Uri("http://localhost:58722"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); itemObj.Cadastro = DateTime.Today; var contentString = new StringContent(JsonConvert.SerializeObject(itemObj), System.Text.Encoding.UTF8, "application/json"); HttpResponseMessage responseMessage = await client.PostAsync($"/api/Item/v1/", contentString); //Verificando se item foi salvo no banco de dados if (responseMessage.IsSuccessStatusCode) { TempData["MSG_SUCESSO"] = Message.MSG_SUCESSO_001; return(RedirectToAction(nameof(CadastrarItem))); } else { TempData["MSG_ERRO"] = Message.MSG_ERRO_001 + responseMessage.StatusCode.ToString(); return(RedirectToAction(nameof(CadastrarItem))); } } catch (Exception e) { TempData["MSG_ERRO"] = Message.MSG_ERRO_001 + e.Message; return(RedirectToAction(nameof(CadastrarItem))); } }
public CraftObj(string Name, ItemObj[] Inputs, ItemObj Output, CraftListType Type) { this.Name = Name; this.Inputs = Inputs; this.Output = Output; this.ListType = Type; }
private void InitLabel() { PlayerDataModule module = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (null == module) { return; } if (PackageType.Pack_Equip == mParam.packtype) { SetDefenceLabel(module); mLabel2.text = StringHelper.GetString("defence_sale_notes"); } else if (ItemManager.GetItemType((uint)mParam.itemid) == ItemType.Defence) { SetDefenceLabel(module); mLabel2.text = ""; } else { ItemObj obj = module.GetItemByID(mParam.itemid); if (null == obj) { return; } mLabel1.text = string.Format(StringHelper.GetString("item_sale_money_count"), obj.GetRes().gameprice *mParam.mSaleNum); mLabel2.text = ""; } }
public ItemObj GetItemByID(int resId, PackageType pack = PackageType.Pack_Bag) { ItemObj item = null; if (pack == PackageType.Invalid) { item = GetItemByIDSinglePackage(resId, PackageType.Pack_Bag); if (item != null) { return(item); } item = GetItemByIDSinglePackage(resId, PackageType.Pack_Equip); if (item != null) { return(item); } item = GetItemByIDSinglePackage(resId, PackageType.Pack_Weapon); if (item != null) { return(item); } item = GetItemByIDSinglePackage(resId, PackageType.Pack_Gem); if (item != null) { return(item); } } else { item = GetItemByIDSinglePackage(resId, pack); } return(item); }
/// <summary> /// Get the object at the given key. If the object is not available, readAll is called. /// </summary> /// <param name="key">Key to identify the object.</param> /// <returns>Object or null, if the object does not exist.</returns> public virtual T this[String key] { get { T v = default(T); if (!TryGetValue(key, out v)) { throw new KeyNotFoundException(key); } return(v); } internal set { rwl.AcquireWriterLock(Timeout.Infinite); try { ItemObj <T> item = makeItemObj(value); ProtectedPutUnsync(key, item); //itemArray = null; } finally { rwl.ReleaseWriterLock(); } } }
public void SetItemObj(ItemObj itemobj) { if (itemobj == null) { Clear(); return; } mPackType = itemobj.PackType; mPackPos = itemobj.PackPos; mItemID = itemobj.GetResId(); SetResID(mItemID); SetNumber(itemobj.GetCount()); if (itemobj is DefenceObj) { DefenceObj defenceObj = itemobj as DefenceObj; if (defenceObj != null) { SetStrenLv(defenceObj.GetStrenLv()); SetStonePic(defenceObj.GetStonePic()); SetStarsLvPic(defenceObj.GetStarsLvPic()); } else { SetStrenLv(-1); SetStonePic(null); SetStarsLvPic(null); } } }
// アイテム追加 public void SetItemData(EventObj obj) { ItemObj item = obj.GetComponent <ItemObj>(); // アイテムデータ _itemGetData = item.ItemData; // 個数 _itemGetNumData = item.ItemNum; if (_itemCircle != null) { if (_itemCircle.gameObject.activeSelf == false) { _itemCircle.gameObject.SetActive(true); } } // アイテムの要素がなかったら追加 if (!_itemTable.ContainsKey(_itemGetData)) { // アイテムリストに追加 _itemTable.Add(_itemGetData, _itemGetNumData); // アイテムサークルにアイコンを追加 _itemGetData.ItemIcon = ItemIcon.Instantiate(_itemIcon, _itemGetData, _itemGetNumData); } else { // 個数だけ追加 _itemTable[_itemGetData] += _itemGetNumData; // 所持数テキストの更新 _itemGetData.ItemIcon.ItemNumText.text = _itemTable[_itemGetData].ToString(); } }
private void UpdateBagGrid(int idx, ItemObj item) { if (idx >= mItemList.Count) { CommonItemUI itemui = new CommonItemUI(item); itemui.gameObject.transform.parent = mItemsGrid.transform; itemui.gameObject.transform.localScale = Vector3.one; itemui.gameObject.transform.localPosition = Vector3.zero; itemui.gameObject.SetActive(false); itemui.SetBoxSize(130.0f, 130.0f); mItemList.Add(itemui); } CommonItemUI grid = mItemList[idx] as CommonItemUI; if (item != null) { grid.SetItemObj(item); } else { grid.SetItemObj(null); } grid.gameObject.name = "ItemUI" + idx.ToString(); grid.gameObject.SetActive(true); }
IEnumerator EnumFunc_SpawnItem() { float fKeepTime = m_ItemKeepTime; //float fAppearDelay = m_ItemAppearDelay; float fAppearDelay = 2; while (m_isCreateItem) { yield return(new WaitForSeconds(fAppearDelay)); if (!m_isCreateItem) { break; } int nAssId = 0; int idx = MakeRandomItemObjID(ref nAssId) - 1; ItemObj kItem = m_listItem[idx]; kItem.Initialize(nAssId, MakeRamdomPos()); yield return(new WaitForSeconds(fKeepTime)); kItem.Show(false); } }
private void Collision_Item(Collider other) { ItemObj kItemObj = other.gameObject.GetComponent <ItemObj>(); ActorInfo kActorInfo = GameMgr.Inst.m_GameInfo.m_ActorInfo; AssetItem kAssItem = AssetMgr.Inst.GetAssetItem(kItemObj.m_ID); GameInfo kGameInfo = GameMgr.Inst.m_GameInfo; if (kAssItem.m_ItemType == (int)ItemInfo.Type.eHealing) { m_ItemObjMgr.HideItem(other.gameObject); kActorInfo.m_HP += (int)kAssItem.m_Value; if (kActorInfo.m_HP > kActorInfo.m_MaxHP) { kActorInfo.m_HP = kActorInfo.m_MaxHP; } } else if (kAssItem.m_ItemType == (int)ItemInfo.Type.eExplose) { m_ItemObjMgr.HideItem(other.gameObject); DestroyTurMissile(); kGameInfo.InvinStart(kAssItem.m_Value); Debug.Log("d"); } else if (kAssItem.m_ItemType == (int)ItemInfo.Type.eDoubleAtk) { m_ItemObjMgr.HideItem(other.gameObject); kGameInfo.DmgMulStart(kAssItem.m_Value2, kAssItem.m_Value); kGameInfo.DmgMul(); } }
public async Task <IActionResult> AtualizarItem(long Codigo) { try { ItemObj itemObj = new ItemObj(); //TODO - Criar uma configuração para guardar esta informação if (client == null) { client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:58722"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); } var responseMessage = await client.GetAsync($"/api/Item//v1/consultarItemPorCodigo/" + Codigo); if (responseMessage.IsSuccessStatusCode) { itemObj = await responseMessage.Content.ReadAsAsync <ItemObj>(); } return(View(itemObj)); } catch (Exception e) { TempData["MSG_ERRO"] = Message.MSG_ERRO_001 + e.Message; return(RedirectToAction(nameof(AtualizarItem))); } }
private void PutItem(ItemObj item, PackageType packageType, int pos /*, bool hint*/) { if (packageType <= PackageType.Invalid || packageType >= PackageType.Pack_Max) { return; } item.PackType = packageType; item.PackPos = pos; //if(hint) //{ // string content = StringHelper.GetString("egg_get_item") + ItemManager.getItemNameWithColor(item.GetResId()) + " X " + item.GetCount(); // PopTipManager.Instance.AddNewTip(content); //} Dictionary <int, ItemObj> pack = mPacks[(int)packageType] as Dictionary <int, ItemObj>; if (!pack.ContainsKey(pos)) { pack.Add(pos, item); } else { pack[pos] = item; } }
/// <summary> /// Reads all SordType objects from IndexServer and update the cache. /// </summary> protected override void ProtectedLoadAllObjectsUnsync() { SordType[] sordTypes = ix.checkoutSordTypes(null, readMembersZVal, LockC.NO); Items = sordTypes; itemArrayFolders = null; itemArrayDocuments = null; imageListsValue = null; }
public bool SameItem(ItemObj other) { if (other == null) { return(false); } return(item == other.item); }
public CommonItemUI(PackageType packtype, int packpos) { InitUI(); PlayerDataModule module = ModuleManager.Instance.FindModule <PlayerDataModule>(); ItemObj itemobj = module.GetItem(packtype, packpos); SetItemObj(itemobj); }
public ItemObj CreateItem(ItemObjInit initData) { if (initData == null) { return(null); } ItemObj itemobj = null; switch (GetItemType((uint)initData.mResId)) { case ItemType.Normal: { itemobj = new NormalItemObj(); } break; case ItemType.Defence: { itemobj = new DefenceObj(); } break; case ItemType.Weapon: { itemobj = new WeaponObj(); } break; case ItemType.Stone: { itemobj = new StoneObj(); } break; case ItemType.Box: { itemobj = new BoxItemObj(); } break; default: break; } if (itemobj == null) { return(null); } if (!itemobj.Init(initData)) { return(null); } return(itemobj); }
private void modificarItemShop(ItemLoja item, bool lojaAberta, string estabelecimentoId) { ItemObj objItemShop = lstItensLoja.Find(x => x.ItemLoja._id == item._id); if (objItemShop != null) { objItemShop.PreencherInfo(item, lojaAberta, estabelecimentoId); } }
protected void DelAllLoop() { int loopCount = itemLoop.Count; for (int i = 0; i < loopCount; i++) { ItemObj item = itemLoop.Dequeue(); Destroy(item.m_widget.gameObject); } }
/// <summary> /// 构造一个 item 对象 /// </summary> /// <returns>The item.</returns> ItemObj CreateItem() { GameObject go = NGUITools.AddChild(m_parent, itemPrefab); UIWidget m_widget = go.GetComponent <UIWidget>(); ItemObj item = go.GetComponent <ItemObj>();//new LoopItemObject(); item.m_widget = m_widget; go.SetActive(true); return(item); }
/// <summary> /// 用数据列表来初始化scrollview /// </summary> /// <param name="item">Item.</param> /// <param name="indexData">Index data.</param> /// <param name="data">Data.</param> void InitItem(ItemObj item, int dataIndex, ItemData data) { item.dataIndex = dataIndex; // print(item.gameObject.name); if (OnItemInit != null) { OnItemInit(item, data); } item.m_widget.transform.localPosition = itemStartPos; }
/// <summary> /// Add a sord into the cache. /// </summary> /// <param name="sord">Sord object</param> protected override void ProtectedAddUnsync(Sord sord) { if (lifetimeTicks != 0) { ItemObj <Sord> item = makeItemObj(sord); ProtectedPutUnsync(sord.guid, item); if (sord.id > 0) { ProtectedPutUnsync(Convert.ToString(sord.id), item); } } }
public string[] ListToStringArray() { string[] stringInfoStrings = new string[this.taskList.Count]; int i = 0; foreach (Task ItemObj in taskList) { stringInfoStrings[i++] = ItemObj.ToString(); } return(stringInfoStrings); }
/// <summary> /// 将要移除的item放入对象池中 /// --这个里我保证这个对象池中存在的对象不超过3个 /// </summary> /// <param name="item">Item.</param> protected void PutItemToLoop(ItemObj item) { if (itemLoop.Count >= 3) { Destroy(item.m_widget.gameObject); return; } item.dataIndex = -1; //item.m_widget.gameObject.SetActive(false); //item.m_widget.gameObject.transform.localPosition = new Vector3(0,1000,0); itemLoop.Enqueue(item); }
void GenerateJunkItem(GameObject item, EItemType type, ItemsData itemList) { ItemObj itemObjScr = AddItemObjScript(item); itemObjScr.ItemType = type; int ranId = Random.Range(0, itemList.JunkItemsList.Count); itemObjScr.ItemId = itemList.JunkItemsList[ranId].ItemId; //itemObjScr.JunkItemInfo = itemList.JunkItemsList[ranId]; itemList.JunkItemsList.RemoveAt(ranId); convertListToSt(itemList); }
/// <summary> /// Adds a mask object into the cache. /// Aquires synchronized access to the cache. /// </summary> /// <param name="obj">DocMask object</param> protected override void ProtectedAddUnsync(DocMask obj) { String key1 = Convert.ToString(obj.id, CultureInfo.InvariantCulture); ItemObj <DocMask> item = makeItemObj(obj); ProtectedPutUnsync(key1, item); ProtectedPutUnsync(obj.name, item); if (obj.guid != null && obj.guid.Length != 0) { ProtectedPutUnsync(obj.guid, item); } }
/// <summary> /// Puts the given color object into the cache. /// The caller is responsible for synchronization. /// </summary> /// <param name="obj"></param> protected override void ProtectedAddUnsync(ColorData obj) { colorNamesItem = null; ItemObj <ColorData> itemObj = makeItemObj(obj); ProtectedPutUnsync(Convert.ToString(obj.id, CultureInfo.InvariantCulture), itemObj); ProtectedPutUnsync(obj.name, itemObj); if (obj.guid != null && obj.guid.Length != 0) { ProtectedPutUnsync(obj.guid, itemObj); } }
//public bool ChangeItem(ShoppingItem itemIn, int index) //{ // bool ok = false; // if (CheckIndex(index)) // { // ok = true; // this.itemList[index] = itemIn; // } // return ok; //} //public bool DeleteItem(int index) //{ // bool ok = false; // if (CheckIndex(index)) // { // ok = true; // this.itemList.RemoveAt(index); // } // return ok; //} public string[] GetItemsInfoStrings() { string[] stringInfoStrings = new string[this.itemList.Count]; int i = 0; foreach (ShoppingItem ItemObj in itemList) { stringInfoStrings[i++] = ItemObj.ToString(); } return(stringInfoStrings); }
public void IfSetSlotsOccupied(bool set, bool IfSetBackground) { ItemObj itemObj = transform.GetComponent <GetItemData>().GetItemObj(); itemOnMOuse = itemObj; Debug.Log(itemObj.name); float PositionX; float PositionY; float FloatWidth = itemObj.width; float FloatHeight = itemObj.height; DropX = transform.position.x; DropY = transform.position.y; if (inventory.OddOrEven(itemObj.width) == 0) { PositionX = (float)(DropX - 80 * (FloatWidth / 4)); Debug.Log("sss" + PositionX); } else { PositionX = (float)(DropX - 80 * ((FloatWidth - 1) / 2)); //Debug.Log("sss" + PositionX); } if (inventory.OddOrEven(itemObj.height) == 0) { PositionY = (float)(DropY - 80 * (FloatHeight / 4)); } else { PositionY = (float)(DropY - 80 * ((FloatHeight - 1) / 2)); } SlotX = (int)((PositionX - inventory.x) / 80); SlotY = (int)((PositionY - inventory.y) / 80); //Debug.Log(SlotX + "," + SlotY + "bug"); for (int CheckX = SlotX; CheckX < itemObj.width + SlotX; CheckX++) { for (int CheckY = SlotY; CheckY < itemObj.height + SlotY; CheckY++) { inventory.slots[CheckX, CheckY].Occupied = set; //Debug.Log(CheckX + " " + CheckY + " " + inventory.slots[CheckX, CheckY].Occupied); if (IfSetBackground == true) { PositionX = CheckX * 80 + inventory.x; PositionY = CheckY * 80 + inventory.y; backgrounds.Add(Instantiate(Background, new Vector3(PositionX, PositionY, 0), Quaternion.identity, InventoryI)); } } } }
public int AddAmount(ItemObj other) { amount = amount + other.amount; if (isLimited && amount > item.max_amount) { int remaining = amount - item.max_amount; amount = item.max_amount; count.text = amount.ToString(); return(remaining); } count.text = amount.ToString(); return(0); }