protected override void initPaymentMenu(PlayerController customer) { int pay = Merchant.getAmountPayment(); Skip = false; if (pay == 0) { Skip = true; return; } string[] captions = new string[3]; captions[0] = "代金は合わせて"; captions[1] = WindowConfigure.setColorTag(string.Format("{0,6}", pay), Color.yellow) + " Gに"; captions[2] = "にゃりますがよろしいですかにゃ?"; var submit = new YesNoMenu(customer, captions); submit.YesAct = delegate () { if (pay > customer.Parameter.Inventory.Wallet) { Message.setMessage("お金が足りませんにゃ。"); } else { customer.Parameter.Inventory.subMoney(pay); customer.Parameter.Inventory.payment(false); Merchant.getCommoditiesOutSideShop().ForEach(item => item.Object.payment(false)); Message.setMessage("お買い上げありがとうございますにゃ。"); GameController.DungeonInformation.ListOfUnpaidCommodityWhichNotExistOnFiled.Clear(); } //customer.Parameter.Inventory.remove(items); //MenuContoller.doDisableAllMenu(); submit.close(); MenuContoller.doEnableMenu(Message); Payment = true; }; submit.NoAct = delegate () { //MenuContoller.doDisableMenu(); Message.setMessage("それは残念ですにゃ。"); MenuContoller.doEnableMenu(Message); submit.cancelclose(); Payment = true; }; MenuContoller.doEnableMenu(submit); }
protected override void initPaymentMenu(PlayerController customer) { int pay = 0; int itemcount = Items.Length; foreach (ItemBasis item in Items) { pay += item.SellingPrice; if (item is IHasInventoryItem) { itemcount += (item as IHasInventoryItem).getInventory().ItemCount; pay += (item as IHasInventoryItem).getInventory().sumSellingPrice(); } } string[] captions = new string[3]; captions[0] = string.Format("全部で{0}個のアイテムを、", itemcount); captions[1] = WindowConfigure.setColorTag(string.Format("{0,6}", pay), Color.yellow) + " Gで、"; captions[2] = "売りますかにゃ?"; var submit = new YesNoMenu(customer, captions); submit.YesAct = delegate () { //customer.Parameter.Inventory.remove(items); customer.Parameter.Inventory.addMoney(pay); Message.setMessage("代金をお渡ししますにゃ。"); foreach (ItemBasis item in Items) { item.payment(true); } //MenuContoller.doDisableAllMenu(); submit.close(); MenuContoller.doEnableMenu(Message); Payment = true; }; submit.NoAct = delegate () { //MenuContoller.doDisableMenu(); Message.setMessage("それは残念ですにゃ。"); submit.cancelclose(); MenuContoller.doEnableMenu(Message); Payment = true; }; MenuContoller.doEnableMenu(submit); }
private void initOtherMenu() { List<string> strs = new List<string>(); strs.Add(StopGame); strs.Add(EagleEye); strs.Add(Configure); if (GameController.CurrentFieldMode == GameController.FieldMode.DUNGEON) strs.Add(Retire); Vector2 pos = WindowConfigure.createScreenPoint(0.4f,0.4f); Vector2 size = WindowConfigure.createFontScaleForVector(8,strs.Count+1.5f); othermenu = new MultiChoicesMenu(WindowOwner,strs.ToArray(),pos,size,othermenuaction); string firstsubmit = "今回の冒険をあきらめて脱出しますか?"; Vector2 submitpos = othermenu.Window.WindowPosition + WindowConfigure.createFontScaleForVector(0.5f, 1); Vector2 submitsize =WindowConfigure.getTextAreaSize(1f, 1f, firstsubmit); firstsubmitretire = new YesNoMenu(WindowOwner,submitpos,submitsize,firstsubmit); string[] secondsubmit = {"あきらめた場合倒れた扱いになります。","本当にあきらめますか?" }; submitpos += WindowConfigure.createFontScaleForVector(0.5f,0); submitsize = WindowConfigure.getTextAreaSize(1f,1f,secondsubmit); secondsubmitretire = new YesNoMenu(WindowOwner,submitpos,submitsize,secondsubmit); firstsubmitretire.YesAct = delegate { firstsubmitretire.close(); secondsubmitretire.open(); }; firstsubmitretire.NoAct = delegate { firstsubmitretire.cancelclose(); }; secondsubmitretire.YesAct = delegate { MenuContoller.doDisableAllMenu(); GameController.GameActionEvent.dungeonRitire(WindowOwner, GameController.DungeonInformation); }; secondsubmitretire.NoAct = delegate { secondsubmitretire.cancelclose();}; }
public override void pushedDecideKey() { if (Commodities.Length == 0) return; int pay = 0; ItemBasis[] items; if (Window.MultiSelectedIndexList.Count == 0) { items = new ItemBasis[] {SelectedItem}; //pay = payment(SelectedItem); } else { items = getMultiSelectedItemList().ToArray(); //pay = payment(getMultiSelectedItemList().ToArray()); } pay = payment(items); string[] captions = new string[3]; captions[0] = string.Format("全部で{0}個のアイテムを、", items.Length); captions[1] = WindowConfigure.setColorTag(string.Format("{0,6}",pay),Color.yellow) + " Gで、"; captions[2] = PlayerSellMode ? "売りますかにゃ?" : "買いますかにゃ?"; var submit = new YesNoMenu(Customer,captions); submit.YesAct = delegate () { if (!PlayerSellMode) { if (pay > Customer.Parameter.Inventory.Wallet) { Message.setMessage("お金が足りませんにゃ。"); } else { if (Customer.Parameter.Inventory.isFreeCapasity(items.Length)) { Customer.Parameter.Inventory.subMoney(pay); foreach (var item in items) { Customer.Parameter.Inventory.add(item.Clone()); } Message.setMessage("お買い上げありがとうございますにゃ。"); } else { Message.setMessage("持ちきれないほど買うのはダメですにゃ。"); } } MenuContoller.doDisableAllMenu(); MenuContoller.doEnableMenu(Message); } else { Customer.Parameter.Inventory.remove(items); Customer.Parameter.Inventory.addMoney(pay); Message.setMessage("代金をお渡ししますにゃ。"); MenuContoller.doDisableAllMenu(); MenuContoller.doEnableMenu(Message); } }; submit.NoAct = delegate () { //MenuContoller.doDisableMenu(); submit.cancelclose(); }; MenuContoller.doEnableMenu(submit); //throw new NotImplementedException(); }
public DungeonCompositorMenu(PlayerController owner,CompositionLeve compositionlevel,int saveslotnumber) : base(rowsize,1,owner,pos,size,"DungeonCompositer") { this.PlayerInventoryItems = owner.Parameter.Inventory.FindAll(item => item is IDungeonMaterial).ToArray(); this.PlayerWareHouseItems = owner.Parameter.WareHouseInventory.FindAll(item => item is IDungeonMaterial).ToArray(); Window.SkipText.Add(""); Window.WindoName = "ItemList"; Window.HighLightVisibleWhenUnFocus = false; SelectedItems = new List<SelectedItemEntity>(); init(PlayerInventoryItems); CurrentCompositionLevel = compositionlevel; SelectedItemTexts = new WindowText[(int)compositionlevel]; CurrentInventory = SelectedInventory.PLAYER; resetPageText(); CurrentFocusMenu = this.Window; ButtonMenu = new SelectableWindow(1, 3,pos + new Vector2(0,this.MainWindow.WindowSize.y + 40), WindowConfigure.createFontScaleForVector(12.5f,1.8f),"Button"); ButtonMenu.HighLightVisibleWhenUnFocus = false; var buttons = new WindowText[3]; var orgpos = ButtonMenu.TextAreaPosition; int idx = 0; buttons[0] = new WindowText(WareHouseLabel, orgpos); var posdelta = buttons[idx].Position + new Vector2(WindowConfigure.fontScale(buttons[idx].Text.Length + 1.2f), 0); buttons[1] = new WindowText(SubmitButton, posdelta); idx++; posdelta = buttons[idx].Position + new Vector2(WindowConfigure.fontScale(buttons[idx].Text.Length + 0.5f), 0); buttons[2] = new WindowText(CancelButton, posdelta); for (int i = 0; i < ButtonMenu.ColumnSize; i++) { ButtonMenu.setText(buttons[i], 0, i); } ButtonMenu.CurrentPageNum = 0; ButtonMenu.SelectColumnIndex = 0; ButtonMenu.SelectRowIndex = 0; /// Vector2 viewpos = this.Window.WindowPosition; viewpos.x += this.Window.WindowSize.x+10; Vector2 viewsize = new Vector2(WindowConfigure.fontScale(12),WindowConfigure.fontScale((int)compositionlevel*1.5f)); SelectedItemWindow = new ViewOnlyWindow(viewpos, viewsize, "SelectedItem"); orgpos = SelectedItemWindow.TextAreaPosition; for (int i = 0; i < SelectedItemTexts.Length; i++) { SelectedItemTexts[i] = new WindowText("",orgpos+new Vector2(0,WindowConfigure.fontScale(i*1.05f))); } SelectedItemWindow.addWindowText(SelectedItemTexts); resetSelectItemTexts(); /// PreviewTexts = new WindowText[PreviewLables.Length]; viewpos = SelectedItemWindow.WindowPosition + new Vector2(0, SelectedItemWindow.WindowSize.y + 80); viewsize = new Vector2(WindowConfigure.fontScale(12), WindowConfigure.fontScale(PreviewTexts.Length+1.5f)); PreviewWindow = new ViewOnlyWindow(viewpos, viewsize, "Preview"); orgpos = PreviewWindow.TextAreaPosition; ///--- for (int i = 0; i < PreviewTexts.Length; i++) { PreviewTexts[i] = new WindowText(PreviewLables[i], orgpos+(new Vector2(0, WindowConfigure.fontScale(1.25f)*i))); } //PreviewTexts[0] = new WindowText(MaxRank,orgpos); //PreviewTexts[1] = new WindowText(MaxFloorNum, PreviewTexts[0].Position + new Vector2(0, WindowConfigure.fontScale(1.25f))); ///--- PreviewWindow.addWindowText(PreviewTexts); /// Compositor = new DungeonCompositor(); SaveSlotNumber = saveslotnumber; this.SubWindows.Add(PreviewWindow); this.SubWindows.Add(SelectedItemWindow); this.SubWindows.Add(ButtonMenu); /// SubmitCaption = new ViewOnlyWindow(submitpos, submitsize); SubmitCaption.addWindowText(new WindowText(SubmitText,SubmitCaption.TextAreaPosition)); SubmitMenu = new YesNoMenu(owner, SubmitCaption); SubmitMenu.YesAct = delegate () { Debug.Log("Yes"); MenuContoller.doDisableMenu(SubmitMenu); StringInputSystem.initInputMenu(owner, 12); StringInputSystem.menuOpen((text,iscancel) => { if (iscancel) return; var dgparam = Compositor.createParameter(text); GameController.DgParameterTable[SaveSlotNumber] = dgparam; for (int i = 0; i < GameController.DgParameterTable.TableSize; i++) { var param = GameController.DgParameterTable[i]; string name; if (param == null) { name = "NULL"; } else { name = param.DungeonName; } Debug.LogFormat("[{0}]:{1}", i, name); } MenuContoller.doDisableAllMenu(); }); }; SubmitMenu.NoAct = delegate () { Debug.Log("No"); SubmitMenu.cancelclose(); changeFocus(WindowFocus.BUTTON); }; /// if (PlayerInventoryItems.Length != 0) { changeFocus(WindowFocus.ITEM); } else { changeFocus(WindowFocus.BUTTON); } setOnePageTexts(); updatePreview(); }