private void _onBuy(string slug, SerializablePropertys.Property property, SerializablePackages.PayBy payBy) { if (payBy.coin <= 0) { //Free _onBuy1(slug, property, payBy); return; } int currentCoin = TriggerGame.Instance.WorldFlag["Coin"]; if (currentCoin < payBy.coin) { string name_item = NameOf(property, slug); string text = string.Format("Sorry, {0} costs ${1} {2}, you don't have enough!", name_item, payBy.coin, DefineAON.CoinName); _controlShop.contentPane.visible = false; InputFieldHelper.Instance.ShowChatBottom(text, true, (TypingEffectByLine ty) => { _controlShop.contentPane.visible = true; }); } else { TriggerGame.Instance.WorldFlag.DoAdd("Coin", -payBy.coin); _onBuy1(slug, property, payBy); } }
private void _onBuy1(string slug, SerializablePropertys.Property property, SerializablePackages.PayBy payBy) { _controlShop.contentPane.visible = false; string name_item = NameOf(property, slug); // string last_text = InputFieldHelper.Instance.LastTextChatBottom(); string text = string.Format("{0} costs ${1} {2}", name_item, payBy.coin, DefineAON.CoinName); text += "\nThank you very much for your purchase!"; // text += string.Format("\nThe {0} was putted in your Bag!", name_item); InputFieldHelper.Instance.ShowChatBottom(text, true, (TypingEffectByLine ty) => { PropertysGame.PropertyChar pChar = PropertysGame.Instance.AddItem(m_dataRaw, slug); RefreshDataSelect(); if (property.IsOutfit || property.IsPet) { _onBuy2(name_item, slug, property, pChar); } else { if (mOnBuy != null) { mOnBuy(_controlShop); } } }); }
private bool OnGuiBot(SerializablePackages packages, SerializablePropertys propertys, List <FlagAction> listFlagAction, TilesetAON tilesetAON, Rect rect) { if (packages == null) { return(false); } float yGui = rect.y + 4; float widthLeft = 250; AONGUI.Label(new Rect(rect.x + 4, yGui + DefineAON.GUI_Y_Label, widthLeft, DefineAON.GUI_Height_Label), "Edit package:"); yGui += 32f; { comboBoxSlug.UpdateListContent(packages.AllKey); comboBoxSlug.Empty = "Not selected"; comboBoxSlug.SelectedItemIndex = slugIndex; comboBoxSlug.Rect.x = rect.x; comboBoxSlug.Rect.y = yGui; comboBoxSlug.Rect.width = widthLeft; comboBoxSlug.Rect.height = 32f; comboBoxSlug.Show(rect.height - yGui, "defause", true, false, (int next) => { slugIndex = next; }); } // if(comboBoxSlug.IsDropDownListVisible){ // return true; // } yGui = rect.y + 4; rect.x = rect.x + widthLeft + 4; if (slugIndex < 0 || slugIndex >= packages.Count) { return(true); } AONGUI.Button(new Rect(rect.x, yGui + DefineAON.GUI_Y_Button, 120, DefineAON.GUI_Height_Button), "Remove by slug", () => { packages.Remove(slugIndex); slugIndex = -1; }); SerializablePackages.Package package = packages.PackageByIndex(slugIndex); AONGUI.Button(new Rect(rect.x + 130, yGui + DefineAON.GUI_Y_Button, 120, DefineAON.GUI_Height_Button), "Duplicate by slug", () => { var n = packages.Copy(slugIndex); if (n >= 0) { slugIndex = n; } }); AONGUI.Button(new Rect(rect.x + 260, yGui + DefineAON.GUI_Y_Button, 100, DefineAON.GUI_Height_Label), "Add all Pets", () => { _addAllPets(package, propertys); }); yGui += 32f; AONGUI.Label(new Rect(rect.x, yGui + DefineAON.GUI_Y_Label, 40, DefineAON.GUI_Height_Label), "Name"); AONGUI.TextField(new Rect(rect.x + 40, yGui + DefineAON.GUI_Y_TextField, widthLeft - 40, DefineAON.GUI_Height_TextField), package.Name, (string text) => { package.Name = text; }); yGui += 32f; AONGUI.Label(new Rect(rect.x, yGui + DefineAON.GUI_Y_Label, 40, DefineAON.GUI_Height_Label), "Des"); AONGUI.TextField(new Rect(rect.x + 40, yGui + DefineAON.GUI_Y_TextField, widthLeft - 40, DefineAON.GUI_Height_TextField), package.Des, (string text) => { package.Des = text; }); yGui += 32f; if (propertys == null || propertys.Count <= 0) { AONGUI.Label(new Rect(rect.x, yGui + DefineAON.GUI_Y_Label, widthLeft, DefineAON.GUI_Height_Label), "Propertys is empty"); return(false); } AONGUI.Label(new Rect(rect.x, yGui + DefineAON.GUI_Y_Label, widthLeft, DefineAON.GUI_Height_Label), "Propertys list:"); yGui += 32f; { comboBoxItem.UpdateListContent(package.data.Keys); comboBoxItem.Empty = "Not selected"; comboBoxItem.SelectedItemIndex = itemIndex; comboBoxItem.Rect.x = rect.x; comboBoxItem.Rect.y = yGui; comboBoxItem.Rect.width = widthLeft; comboBoxItem.Rect.height = 32f; comboBoxItem.Show(rect.height - yGui, "defause", true, true, ( int next) => { itemIndex = next; }); } AONGUI.Button(new Rect(rect.x + widthLeft + 10, yGui + DefineAON.GUI_Y_Button, 30, DefineAON.GUI_Height_Label), " + ", () => { if (itemIndex >= 0 && itemIndex < propertys.Count) { package.AddProperty(propertys.SlugByIndex(itemIndex)); } else { package.AddProperty(propertys.SlugByIndex(0)); } }); if (itemIndex < 0) { return(false); } AONGUI.Button(new Rect(rect.x + widthLeft + 50, yGui + DefineAON.GUI_Y_Button, 30, DefineAON.GUI_Height_Label), " - ", () => { package.Remove(itemIndex); }); if (package.data.Count == 0) { return(false); } if (itemIndex >= package.data.Count) { itemIndex = package.data.Count - 1; return(false); } rect.x = rect.x + widthLeft + 10; yGui += 32f; string slugProperty = package.data[itemIndex].property; { // Pick Property bool isWaitUI = false; PropertysGUI.Instance.PickSlugItem(slugIndex.ToString(), propertys, slugProperty, rect.x, yGui, widthLeft, ref yGui, ref isWaitUI, (string slugPropertyPick) => { package.data[itemIndex].property = slugPropertyPick; package.data.ResetKeys(); }); yGui += 32f; } AONGUI.Label(new Rect(rect.x, yGui + DefineAON.GUI_Y_Label, widthLeft, DefineAON.GUI_Height_Label), "Pay by:"); yGui += 32f; SerializablePackages.PayBy payBy = package.data[itemIndex].payBy; AONGUI.Label(new Rect(rect.x, yGui + DefineAON.GUI_Y_Label, 100, DefineAON.GUI_Height_Label), "Coin"); AONGUI.TextField(new Rect(rect.x + 100, yGui + DefineAON.GUI_Y_Label, widthLeft - 100, DefineAON.GUI_Height_Label), payBy.coin.ToString(), (string text) => { payBy.coin = UtilsAON.StrToIntDef(text); }); yGui += 32f; return(false); }
private void _tryOnItem(CharGame charGame, Item rawItem, Item tryItem, string slug, SerializablePropertys.Property property, SerializablePackages.PayBy payBy) { _controlShop.contentPane.visible = false; { // Cam var cam = AutoTileMap_Editor.Instance.CamControler; float _camXAngle_to = cam.camXAngle; float _y_to = cam.yCam; // float _y_to = 0; float _distance_to = cam.minDistance; Vector3 _target_to = charGame.transform.position; cam.MoveCamTo(_camXAngle_to, _y_to, _distance_to, _target_to, () => { // cam.canControl = true; // cam.target = charGame.transform; }); } UnTryCostume(charGame); TryCostume(charGame, rawItem, tryItem); { var b = AutoTileMap_Editor.Instance.Agent.GetComponent <BasicMecanimControl>(); if (b != null) { b.TriggerTalk(); } } var pm_choise = new QuickControlList(); pm_choise.AddBt("Untry", (EventContext context) => { // Debug.Log("Click Cancel"); pm_choise.Dispose(); UnTryCostume(charGame); _controlShop.contentPane.visible = true; }); pm_choise.AddBt("Buy", (EventContext context) => { // Debug.Log("Click Buy"); pm_choise.Dispose(); UnTryCostume(charGame); _onBuy(slug, property, payBy); }); pm_choise.SetParent(InputFieldHelper.Instance.PopUp); // Hide chatBottom var chatBottom = InputFieldHelper.Instance.GComponent_ChatBottom; if (chatBottom != null && chatBottom.visible) { chatBottom.visible = false; pm_choise.SetOnDispose(() => { chatBottom.visible = true; }); } }