private async void btnGetShop_Clicked(object sender, EventArgs e) { try { ShopType shopTypeID = 0; string type = Convert.ToString(pickerType.SelectedItem); //shopTypeID = (type == "Grocery Shop") ? ShopType.GroceryShop : (type == "Medical Shop") ? ShopType.MedicalShop : type == "Vegetables Shop" ? ShopType.VegetablesShop : ShopType.GroceryShop; shopTypeID = (type == "Grocery Shop") ? ShopType.GroceryShop : (type.Contains("Confectionary")) ? ShopType.ConfectionaryShop : ShopType.GroceryShop; string location = Convert.ToString(pickerLocation.SelectedItem); if (!string.IsNullOrWhiteSpace(location)) { if (!string.IsNullOrWhiteSpace(type)) { await Navigation.PushAsync(new ShopList(shopTypeID, location)); } else { await DisplayAlert("Alert", "Please select type !", "Ok"); } } else { await DisplayAlert("Alert", "Please select location !", "Ok"); } } catch (Exception ex) { email.SendMail(ex.Message.ToString()); } }
private void KillSpreads(ShopType shopType, ShopKillFactor factor, bool excludeConeria) { var shops = ShopData.Shops.Where(s => s.Type == shopType).ToList(); if (excludeConeria) { shops = shops.Where(s => s.Location != MapLocation.Coneria).ToList(); } foreach (var shop in shops) { var entries = shop.Entries.Where(e => !QuestItems.Contains(e)).ToList(); entries.Shuffle(rng); var cnt = (int)Math.Round(shop.Entries.Count * GetKillFactor(factor) / 100.0f, 0); var entriesToRemove = entries.Take(cnt).ToList(); foreach (var e in entriesToRemove) { shop.Entries.Remove(e); } if (shop.Entries.Count == 0) { shop.Entries.Add(GetDefaultItem(shopType)); RemoveShopFromMap(shop); } } }
private void KillChaos(ShopType shopType, ShopKillFactor factor, bool excludeConeria) { var shops = ShopData.Shops.Where(s => s.Type == shopType).ToList(); if (excludeConeria) { shops = shops.Where(s => s.Location != MapLocation.Coneria).ToList(); } var allEntries = shops.Select(s => s.Entries.Select(e => (s, e))).SelectMany(x => x).Where(e => !QuestItems.Contains(e.e)).ToList(); allEntries.Shuffle(rng); var cnt = (int)Math.Round(allEntries.Count * GetKillFactor(factor) / 100.0f, 0); var entriesToRemove = allEntries.Take(cnt).ToList(); foreach (var entry in entriesToRemove) { entry.s.Entries.Remove(entry.e); if (entry.s.Entries.Count == 0) { entry.s.Entries.Add(GetDefaultItem(shopType)); RemoveShopFromMap(entry.s); } } }
/// <summary> /// /// </summary> /// <returns>List数据集</returns> public static List <ShopType> GetList() { List <ShopType> list = new List <ShopType>(); string spName = "cudo_getshoptypes"; SqlDataReader dataReader = SqlHelper.ExecuteReader(SqlHelper.ConnectionString, CommandType.StoredProcedure, spName); try { while (dataReader.Read()) { ShopType item = new ShopType(); item.Id = Convert.ToInt32(dataReader["id"]); item.TypeName = dataReader["typename"].ToString(); list.Add(item); } } catch { dataReader.Close(); dataReader.Dispose(); } finally { dataReader.Close(); dataReader.Dispose(); } return(list); }
private List <byte>[] GetShops(ShopType shopType, ushort[] pointers) { var shops = new List <byte> [ShopSectionSize]; for (int i = 0; i < ShopSectionSize; i++) { shops[i] = new List <byte>(); if (pointers[(int)shopType + i] != ShopNullPointer) { if (shopType == ShopType.Clinic || shopType == ShopType.Inn) { shops[i].AddRange(Get(ShopPointerBase + pointers[(int)shopType + i], 2).ToBytes()); } else { var shopEntries = Get(ShopPointerBase + pointers[(int)shopType + i], 5); for (int j = 0; j < 5 && shopEntries[j] != 0; j++) { shops[i].Add(shopEntries[j]); } } } } return(shops); }
/// <summary> /// 根据ID获取Item /// </summary> /// <param name="id">ID</param> /// <returns></returns> public static ShopType GetItem(int id) { ShopType item = null; string spName = "cudo_getshoptypebyid"; SqlParameter[] paramvalues = new SqlParameter[] { new SqlParameter("@id", id) }; SqlDataReader dataReader = SqlHelper.ExecuteReader(SqlHelper.ConnectionString, CommandType.StoredProcedure, spName, paramvalues); try { if (dataReader.Read()) { item = new ShopType(); item.Id = id; item.TypeName = dataReader["typename"].ToString(); } } catch { dataReader.Close(); dataReader.Dispose(); } finally { dataReader.Close(); dataReader.Dispose(); } return(item); }
private void KillShops(ShopType shopType, ShopKillMode mode, ShopKillFactor factor, bool excludeConeria) { if (mode == ShopKillMode.Random) { mode = (ShopKillMode)Math.Max(rng.Between(-3, 4), 0); } if (factor == ShopKillFactor.KillRandom) { factor = (ShopKillFactor)rng.Between(0, 4); } switch (mode) { case ShopKillMode.WholeShops: KillWholeShops(shopType, factor, excludeConeria); break; case ShopKillMode.AllItemsOfAKind: KillAllItemsOfAKind(shopType, factor, excludeConeria); break; case ShopKillMode.Spread: KillSpreads(shopType, factor, excludeConeria); break; case ShopKillMode.Chaos: KillChaos(shopType, factor, excludeConeria); break; default: break; } }
/// <summary> /// 构造函数 /// </summary> /// <param name="shop"></param> /// <param name="channel"></param> public MeiTuanProductChannel(ShopType shop, ProductChannel channel) { Channel = channel; Shop = shop; meituanRepository = new MeiTuanRepository(); hotelRepository = new HotelRepository(channel); MeiTuanConfig config = new MeiTuanConfig(); if (Shop == ShopType.LingZhong || Shop == ShopType.YinJi || Shop == ShopType.RenXing) { config = MeiTuanConfigManager.XiWan; } else if (Shop == ShopType.ShengLv) { config = MeiTuanConfigManager.ShengLv; } else if (Shop == ShopType.RenNiXing) { config = MeiTuanConfigManager.RenNiXing; } meiTuanApiClient = new MeiTuanApiClient(config); logWriter = new LogWriter("Tmall/Validate"); }
public static int GetRemainingScripsByShopType(ShopType shopType) { switch (shopType) { case ShopType.RedCrafter50: return(Scrips.RedCrafter); case ShopType.RedCrafter61: return(Scrips.RedCrafter); case ShopType.YellowCrafterItems: return(Scrips.YellowCrafter); case ShopType.RedGatherer50: return(Scrips.RedGatherer); case ShopType.RedGatherer61: return(Scrips.RedGatherer); case ShopType.YellowGathererItems: return(Scrips.YellowGatherer); } return(0); }
private static void OpenShop(Character character, ShopType type, uint npcConId) { character.SendPacket(new OpenNpcShop(type)); character.OpenedShopType = type; character.OpenedShopNpcConId = npcConId; Log.Debug("Character: {0}, ShopType: {1}", character.Name, type); }
private void KillAllItemsOfAKind(ShopType shopType, ShopKillFactor factor, bool excludeConeria) { var shops = ShopData.Shops.Where(s => s.Type == shopType).ToList(); if (excludeConeria) { shops = shops.Where(s => s.Location != MapLocation.Coneria).ToList(); } var dinstinctEntries = shops.SelectMany(s => s.Entries).Distinct().Where(e => !QuestItems.Contains(e)).ToList(); dinstinctEntries.Shuffle(rng); var cnt = (int)Math.Round(dinstinctEntries.Count * GetKillFactor(factor) / 100.0f, 0); var dinstinctToRemove = new HashSet <Item>(dinstinctEntries.Take(cnt)); foreach (var shop in shops) { shop.Entries = shop.Entries.Where(e => !dinstinctToRemove.Contains(e)).ToList(); if (shop.Entries.Count == 0) { shop.Entries.Add(GetDefaultItem(shopType)); RemoveShopFromMap(shop); } } }
void UpgradeWeapon(WeaponBase weaponBase, ShopType upgradeType) { switch (upgradeType) { case ShopType.UPGRADE_DAMAGE: weaponBase.upgradeDamage++; break; case ShopType.UPGRADE_RELOAD: weaponBase.upgradeReload++; break; case ShopType.UPGRADE_RECOIL: weaponBase.upgradeRecoil++; break; case ShopType.UPGRADE_MAGAZINE: weaponBase.upgradeMag++; weaponBase.RecalculateMagSize(); break; case ShopType.UPGRADE_MAX_AMMO: weaponBase.upgradeMaxAmmo++; weaponBase.RecalculateMaxAmmo(); break; } }
private void SwitchToType(ShopType type) { switch (type) { case ShopType.Charge: ShowChargeTab(); break; case ShopType.Exchange: ShowExchangeTab(); break; case ShopType.Commodity: ShowCommodityTab(); break; case ShopType.Vip: ShowVipTab(); break; case ShopType.YuanBao: ShowYuanBaoTab(); break; } }
public void Show(ShopType type, params ShopType[] hideList) { _showType = type; _hideList = hideList; Show(); }
void GenerateShop(ShopType shopType) { promptPanel.SetActive(false); shoppingPanel.SetActive(true); switch (shopType) { case ShopType.Items: itemPanel.SetActive(true); foreach (Item item in itemsForPurchase) { GameObject newItem = Instantiate(itemTemplate, itemPanel.transform); newItem.name = item.name; newItem.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = item.name; newItem.transform.GetChild(1).GetComponent <TextMeshProUGUI>().text = item.statToBuff + " +" + item.buffValue; newItem.transform.GetChild(2).GetComponent <TextMeshProUGUI>().text = item.goldPrice.ToString() + " Gold"; newItem.transform.GetChild(3).GetComponent <Button>().onClick.AddListener(delegate { currentlySelectedItem = item; OpenCurrentPartyPanel(shopType); }); if (item.goldPrice > partyBehaviour.Gold) { newItem.transform.GetChild(3).GetComponent <Button>().interactable = false; } uiObjectsToDelete.Add(newItem); } break; case ShopType.Mercenaries: mercenaryPanel.SetActive(true); foreach (HeroClass mercenary in mercenariesForHire) { GameObject newMercenary = Instantiate(mercenaryTemplate, mercenaryPanel.transform); newMercenary.name = mercenary.name; newMercenary.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = mercenary.name; newMercenary.transform.GetChild(1).GetComponent <Image>().sprite = mercenary.sprite; newMercenary.transform.GetChild(2).GetComponent <TextMeshProUGUI>().text = mercenary.PrimaryStat; newMercenary.transform.GetChild(3).GetComponent <TextMeshProUGUI>().text = mercenary.goldCost.ToString() + " Gold"; if (mercenary.goldCost <= partyBehaviour.Gold) { newMercenary.transform.GetChild(4).GetComponent <Button>().interactable = true; newMercenary.transform.GetChild(4).GetComponent <Button>().onClick.AddListener(delegate { currentlySelectedMercenary = mercenary; partyBehaviour.Gold -= currentlySelectedMercenary.goldCost; OpenCurrentPartyPanel(shopType); }); } else { newMercenary.transform.GetChild(4).GetComponent <Button>().interactable = false; } uiObjectsToDelete.Add(newMercenary); } break; } }
private void OnRefreshShop(ShopType shopType) { if (_shopType != shopType) { return; } OnRefreshWindow(); }
/// <summary> 상점 보기 </summary> public void ShowShop(ShopType type) { //Debug.Log("들어옴" + type.ToString()); if (onChangedShowShop != null) { onChangedShowShop(type); } }
/// <summary> /// 通过商店类型获得不同的item列表 /// </summary> /// <param name="type"></param> /// <returns></returns> private List <GameObject> GetItemListBytype(ShopType type) { if (itemDic.ContainsKey(type)) { return(itemDic[type]); } return(null); }
/// <summary> /// 通过类型获得缓存的UI /// </summary> /// <param name="type"></param> /// <returns></returns> private List <UI> GetUiListByType(ShopType type) { if (uiDic.ContainsKey(type)) { return(uiDic[type]); } return(null); }
public ShopList(ShopType type, string location) { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); this.shopType = type; this.location = location; LoadShops(); }
public void SetShopItemType(ShopType type) { currentShopType = type; contentIndex = 0; weaponIndex = 0; armorIndex = 0; talismanIndex = 0; }
public override void OnHide() { base.OnHide(); MainPanelInGameUILogic.Hide(); this.m_ChooseEffect.Visible = false; m_curType = ShopType.Prop; m_lastType = ShopType.None; }
public CtripProductChannel(ShopType shopType) { ctripApiClient = new CtripApiClient(Ctrip.Config.ApiConfigManager.ChenYi); this.Shop = shopType; ctripRepository = new CtripRepository(); hotelRepository = new HotelRepository(ProductChannel.Ctrip); logWriter = new LogWriter("Tmall/Validate"); }
// public void ShowGeneralPopup(string title, // string message, // ErrorType errorType = ErrorType.OtherErrors, // string buttonName1 = "", // GumiAction buttonAction1 = null, // string buttonName2 = "", // GumiAction buttonAction2 = null, // bool autoClose = false , // bool top = false) // { // var popup = CreatePopup("General_Popup", top); // // if(popup != null) // { // var handler = popup.GetComponentInChildren<GeneralPopupHandler>(); // handler.Init(title, message, errorType, buttonName1, buttonAction1, buttonName2, buttonAction2, autoClose); // } // } public void ShowShop(ShopType type = ShopType.Gems) { GameObject popup = CreatePopup("ShopPopup", false); if(popup != null) { popup.GetComponentInChildren<ShopHandler>().Init(type); } }
public void OpenShop(ShopType shopType) { promptPanel.SetActive(true); uiObjectsToDelete.Clear(); PopulateSalesLists(); GenerateShop(shopType); }
public void Shop_TC01() { ShopType shopType = _shopContentManager.Select(3); Assert.AreEqual(3, shopType.Number); Assert.AreEqual("General Store", BtrieveUtility.ConvertToString(shopType.Name)); Assert.AreEqual(10, shopType.ShopIndicator); Assert.AreEqual(175, shopType.ShopItemNumber[0]); }
public void setItemData(ShopItemData itemData, ShopInfoUIComponent infoComponent, ShopType type, bool ischoose) { this.m_itemData = itemData; this.m_infoComponent = infoComponent; this.m_curType = type; this.m_isChoose = ischoose; m_lastType = m_curType; }
public void setPanel(ShopItemData itemdata, ShopType currentType) { m_itemdata = itemdata; if (itemdata == null) { return; } m_currentType = currentType; m_NumberRoot.Visible = (m_currentType != ShopType.BlackMarket); m_buyNumber = 1; m_buyPropCount = itemdata.m_number; m_cashType_img.Sprite = ShopHelper.getCashType(itemdata.m_costType); if (itemdata.m_prop != null) { m_icon_img.Sprite = itemdata.m_prop.icon; m_itemName_lab.Text = LocalizeModule.Instance.GetString(itemdata.m_prop.name); m_itemContent_lab.Text = LocalizeModule.Instance.GetString(itemdata.m_prop.description); } m_number_lab.Text = m_buyNumber.ToString(); this.m_sumBgImg.Visible = itemdata.m_number > 1; if (itemdata.m_number > 1) { m_count_lab.Text = string.Format("x{0}", itemdata.m_number); } else { m_count_lab.Text = string.Empty; } if (!itemdata.m_hasDis) { m_disCount_img.Visible = false; m_oriRoot_root.Visible = false; m_cost = itemdata.m_oriPrice * m_buyNumber; m_price_lab.Text = m_cost.ToString(); } else { m_disCount_lab.Text = string.Format("-{0}%", itemdata.m_disCount); m_oriPrice_lab.Text = itemdata.m_oriPrice.ToString(); m_cost = itemdata.m_disPrice * m_buyNumber; m_price_lab.Text = m_cost.ToString(); m_oriRoot_root.Visible = true; m_disCount_img.Visible = true; } if (itemdata.m_limitNumber < 0) { m_limit_root.Visible = false; } else { m_limit_root.Visible = true; m_limit_lab.Text = itemdata.m_limitNumber.ToString(); } checkBtnState(); }
IEnumerator WaitingForDataInitialization(ShopType type) { while (ShopDataController.Instance.isInitialized == false) { yield return(null); } ShowShop(type); }
protected void btnSubmit_Click(object sender, EventArgs e) { ShopType item = new ShopType(); item.TypeName = txtinpTypeName.Value; bll.AddItem(item); txtinpTypeName.Value = ""; PageInit(); }
protected override object this[string index] { get { #region switch (index) { case "ID": return(ID); case "ItemID": return(ItemID); case "LimitType": return(LimitType); case "Discount": return(Discount); case "CurrencyType": return(CurrencyType); case "Price": return(Price); default: throw new ArgumentException(string.Format("Config_Shop index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "ID": _ID = value.ToInt(); break; case "ItemID": _ItemID = value.ToInt(); break; case "LimitType": _LimitType = value.ToEnum <ShopType>(); break; case "Discount": _Discount = value.ToInt(); break; case "CurrencyType": _CurrencyType = value.ToEnum <CoinType>(); break; case "Price": _Price = value.ToInt(); break; default: throw new ArgumentException(string.Format("Config_Shop index[{0}] isn't exist.", index)); } #endregion } }
protected void showShop(ShopType type) { setScreenActive(false); foreach (Shop shop in shops) { if (shop.shopType == type) { shop.showShop(); break; } } InputProcessor.closeShop = true; }
public ShopItem(ShopType ShopType, string Name, string Memo, string PhoneNumber, string Address) { this.Id = -1; //流水號 this.ShopType = ShopType; this.Name = Name; this.Memo = Memo; this.PhoneNumber = PhoneNumber; this.Address = Address; this.UpdateTime = DateTime.Now; this.CreateTime = DateTime.Now; }
public void Init(string buttonLabel, string frameLabel, int index, ShopType type = ShopType.Gems) { m_type = type; m_index = index; m_frameLabel.text = frameLabel; m_buttonLabel.text = buttonLabel; switch(m_type) { case ShopType.Gems: if(m_effect != null) m_effect.spriteName = "UI_Shop_Gem_FX"; if(m_image != null) m_image.spriteName = "UI_Shop_Gem_" + index.ToString(); if(m_buttonBg != null) m_buttonBg.spriteName = "UI_Shop_Gem_Button"; break; case ShopType.Coins: if(m_effect != null) m_effect.spriteName = "UI_Shop_Coin_FX"; if(m_image != null) m_image.spriteName = "UI_Shop_Coin_" + index.ToString(); if(m_buttonBg != null) m_buttonBg.spriteName = "UI_Shop_Coin_Button"; break; case ShopType.Energy: if(m_effect != null) m_effect.spriteName = "UI_Shop_Energy_FX"; if(m_image != null) m_image.spriteName = "UI_Shop_Energy_" + index.ToString(); if(m_buttonBg != null) m_buttonBg.spriteName = "UI_Shop_Energy_Button"; break; } if (m_image != null) { m_image.MakePixelPerfect (); m_image.transform.localScale = new Vector3 (m_image.transform.localScale.x / 2, m_image.transform.localScale.y / 2, 1); } }
internal ShopItem(int Id, ShopType ShopType, string Name, string Memo, string PhoneNumber, string Address, DateTime UpdateTime, DateTime CreateTime) { this.Id = Id; //流水號 this.ShopType = ShopType; this.Name = Name; this.Memo = Memo; this.PhoneNumber = PhoneNumber; this.Address = Address; this.UpdateTime = UpdateTime; this.CreateTime = CreateTime; }
public void Init(ShopType type = ShopType.Gems) { m_itemContainer = new List<GameObject>(); m_type = type; switch(m_type) { case ShopType.Gems: //Load Gems Shop Data //Create shop bundles m_itemContainer.Add(CreateShopItem(0,0)); m_itemContainer.Add(CreateShopItem(5,100)); m_itemContainer.Add(CreateShopItem(10,250)); m_itemContainer.Add(CreateShopItem(50,1550)); m_grid.repositionNow = true; m_tabs[0].isEnabled = false; m_tabs[1].isEnabled = true; m_tabs[2].isEnabled = true; break; case ShopType.Coins: m_itemContainer.Add(CreateShopItem(0,0)); m_itemContainer.Add(CreateShopItem(5,100)); m_itemContainer.Add(CreateShopItem(10,250)); m_itemContainer.Add(CreateShopItem(50,1550)); m_tabs[0].isEnabled = true; m_tabs[1].isEnabled = false; m_tabs[2].isEnabled = true; m_grid.repositionNow = true; break; case ShopType.Energy: m_itemContainer.Add(CreateShopItem(0,0)); m_itemContainer.Add(CreateShopItem(5,100)); m_itemContainer.Add(CreateShopItem(10,250)); m_itemContainer.Add(CreateShopItem(50,1550)); m_tabs[0].isEnabled = true; m_tabs[1].isEnabled = true; m_tabs[2].isEnabled = false; m_grid.repositionNow = true; break; } }
/// <summary> /// 增加物品 /// </summary> /// <param name="itemID"></param> /// <param name="num"></param> public void AddUserItem(int itemID, int num, ShopType shopType) { UserItem item = new UserItem(); item.UserItemID = Guid.NewGuid().ToString(); item.ItemID = itemID; item.Num = num; item.ShopType = shopType; var package = Get(); if (package != null) { package.ItemPackage.Add(item); } }
public static int GetRemainingScripsByShopType(ShopType shopType) { switch (shopType) { case ShopType.BlueCrafter: return BlueCrafter; case ShopType.RedCrafter: return RedCrafter; case ShopType.BlueGatherer: return BlueGatherer; case ShopType.RedGatherer: return RedGatherer; } return 0; }
public static bool IsPurchasable(uint id, ShopType shop) { var shopFlags = ShopFlags.None; switch (shop) { case ShopType.Base: shopFlags = ShopFlags.Base; break; case ShopType.Side: shopFlags = ShopFlags.Side; break; case ShopType.Secret: shopFlags = ShopFlags.Secret; break; } ShopFlags itemFlags; if (!ItemShops.TryGetValue(id, out itemFlags)) { itemFlags = ShopFlags.Base; } return itemFlags.HasFlag(shopFlags); }
protected override object this[string index] { get { #region switch (index) { case "ItemID": return ItemID; case "CityID": return CityID; case "MallType": return MallType; case "QishiID": return QishiID; case "SeqNO": return SeqNO; case "Price": return Price; case "OpenFilter": return OpenFilter; case "SpecialPrice": return SpecialPrice; default: throw new ArgumentException(string.Format("MallItemsInfo index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "ItemID": _ItemID = value.ToInt(); break; case "CityID": _CityID = value.ToInt(); break; case "MallType": _MallType = value.ToEnum<ShopType>(); break; case "QishiID": _QishiID = value.ToInt(); break; case "SeqNO": _SeqNO = value.ToInt(); break; case "Price": _Price = value.ToInt(); break; case "OpenFilter": _OpenFilter = value.ToNotNullString(); break; case "SpecialPrice": _SpecialPrice = value.ToInt(); break; default: throw new ArgumentException(string.Format("MallItemsInfo index[{0}] isn't exist.", index)); } #endregion } }
/// <summary> /// 增加物品 /// </summary> /// <param name="itemID"></param> public void AddUserItem(int itemID, ShopType shopType) { AddUserItem(itemID, 1, shopType); }
private List<byte>[] GetShops(ShopType shopType, ushort[] pointers) { var shops = new List<byte>[ShopSectionSize]; for (int i = 0; i < ShopSectionSize; i++) { shops[i] = new List<byte>(); if (pointers[(int)shopType + i] != ShopNullPointer) { if (shopType == ShopType.Clinic || shopType == ShopType.Inn) { shops[i].AddRange(Get(ShopPointerBase + pointers[(int)shopType + i], 2).ToBytes()); } else { var shopEntries = Get(ShopPointerBase + pointers[(int)shopType + i], 5); for (int j = 0; j < 5 && shopEntries[j] != 0; j++) { shops[i].Add(shopEntries[j]); } } } } return shops; }
protected override object this[string index] { get { #region switch (index) { case "ShopID": return _shopID; case "ShopName": return _shopName; case "HeadID": return _headID; case "ShopType": return _shopType; case "SeqNO": return _seqNO; case "Price": return _price; case "VipPrice": return _vipPrice; case "GameCoin": return _gameCoin; case "ShopDesc": return _shopDesc; default: throw new ArgumentException(string.Format("ShopInfo index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "ShopID": _shopID = value.ToInt(); break; case "ShopName": _shopName = value.ToNotNullString(); break; case "HeadID": _headID = value.ToNotNullString(); break; case "ShopType": _shopType = value.ToEnum<ShopType>(); break; case "SeqNO": _seqNO = value.ToShort(); break; case "Price": _price = value.ToInt(); break; case "VipPrice": _vipPrice = value.ToInt(); break; case "GameCoin": _gameCoin = value.ToInt(); break; case "ShopDesc": _shopDesc = value.ToNotNullString(); break; default: throw new ArgumentException(string.Format("ShopInfo index[{0}] isn't exist.", index)); } #endregion } }
private void ShuffleShopType(ShopType shopType, ushort[] pointers, MT19337 rng) { var shops = GetShops(shopType, pointers); var allEntries = shops.SelectMany(list => list).ToList(); allEntries.Shuffle(rng); var newShops = new List<byte>[ShopSectionSize]; var entry = 0; for (int i = 0; i < ShopSectionSize; i++) { newShops[i] = new List<byte>(); if (pointers[(int)shopType + i] != ShopNullPointer) { newShops[i].Add(allEntries[entry++]); } } while (entry < allEntries.Count) { var tryShop = newShops[rng.Between(0, ShopSectionSize - 1)]; if (tryShop.Count > 0 && tryShop.Count < 5 && !tryShop.Contains(allEntries[entry])) { tryShop.Add(allEntries[entry++]); } } foreach (var newShop in newShops) { newShop.Add(0); } var pointer = pointers[(int)shopType]; for (int i = 0; i < ShopSectionSize; i++) { if (newShops[i].Count > 1) { Put(ShopPointerBase + pointer, newShops[i].ToArray()); pointers[(int)shopType + i] = pointer; pointer += (ushort)newShops[i].Count; } } }
void OnTabClick(GameObject obj) { m_index = 1; if(obj.name.CompareTo("Gems") == 0) { ClearAll(); m_type = ShopType.Gems; m_itemContainer.Add(CreateShopItem(0,0)); m_itemContainer.Add(CreateShopItem(5,100)); m_itemContainer.Add(CreateShopItem(10,250)); m_itemContainer.Add(CreateShopItem(50,1550)); m_tabs[0].isEnabled = false; m_tabs[1].isEnabled = true; m_tabs[2].isEnabled = true; } else if (obj.name.CompareTo("Coins") == 0) { ClearAll(); m_type = ShopType.Coins; m_itemContainer.Add(CreateShopItem(0,0)); m_itemContainer.Add(CreateShopItem(5,100)); m_itemContainer.Add(CreateShopItem(10,250)); m_itemContainer.Add(CreateShopItem(50,1550)); m_tabs[0].isEnabled = true; m_tabs[1].isEnabled = false; m_tabs[2].isEnabled = true; } else if (obj.name.CompareTo("Energy") == 0) { ClearAll(); m_type = ShopType.Energy; m_itemContainer.Add(CreateShopItem(0,0)); m_itemContainer.Add(CreateShopItem(5,100)); m_itemContainer.Add(CreateShopItem(10,250)); m_itemContainer.Add(CreateShopItem(50,1550)); m_tabs[0].isEnabled = true; m_tabs[1].isEnabled = true; m_tabs[2].isEnabled = false; } isDirty = true; }