private void RedBlueGreen_Click(object sender, EventArgs e) { if (PictureBox1.Image == null) { alert.Show(); } else { if (boolrbg == true) { RedButton.Show(); BlueButton.Show(); GreenButton.Show(); boolrbg = false; } else if (boolrbg == false) { RedButton.Hide(); BlueButton.Hide(); GreenButton.Hide(); boolrbg = true; } } }
public WndWandmaker(Wandmaker wandmaker, Item item) { _wandmaker = wandmaker; _item = item; var titlebar = new IconTitle(); titlebar.Icon(new ItemSprite(item.image, null)); titlebar.Label(Utils.Capitalize(item.Name)); titlebar.SetRect(0, 0, WIDTH, 0); Add(titlebar); var message = PixelScene.CreateMultiline(TxtMessage, 6); message.MaxWidth = WIDTH; message.Measure(); message.Y = titlebar.Bottom() + Gap; Add(message); var btnBattle = new RedButton(TxtBattle); btnBattle.ClickAction = BattleAction; btnBattle.SetRect(0, message.Y + message.Height + Gap, WIDTH, BtnHeight); Add(btnBattle); var btnNonBattle = new RedButton(TxtNonBattle); btnNonBattle.ClickAction = NonBattleAction; btnNonBattle.SetRect(0, btnBattle.Bottom() + Gap, WIDTH, BtnHeight); Add(btnNonBattle); Resize(WIDTH, (int)btnNonBattle.Bottom()); }
public WndImp(Imp imp, DwarfToken tokens) { _imp = imp; _tokens = tokens; var titlebar = new IconTitle(); titlebar.Icon(new ItemSprite(tokens.Image, null)); titlebar.Label(Utils.Capitalize(tokens.Name)); titlebar.SetRect(0, 0, WIDTH, 0); Add(titlebar); BitmapTextMultiline message = PixelScene.CreateMultiline(TxtMessage, 6); message.MaxWidth = WIDTH; message.Measure(); message.Y = titlebar.Bottom() + Gap; Add(message); var btnReward = new RedButton(TxtReward); btnReward.ClickAction = RewardClickAction; btnReward.SetRect(0, message.Y + message.Height + Gap, WIDTH, BtnHeight); Add(btnReward); Resize(WIDTH, (int)btnReward.Bottom()); }
public WndSadGhost(Ghost ghost, Item item) { _ghost = ghost; _item = item; var titlebar = new IconTitle(); titlebar.Icon(new ItemSprite(item.image, null)); titlebar.Label(Utils.Capitalize(item.Name)); titlebar.SetRect(0, 0, WIDTH, 0); Add(titlebar); BitmapTextMultiline message = PixelScene.CreateMultiline(item is DriedRose ? TxtRose : TxtRat, 6); message.MaxWidth = WIDTH; message.Measure(); message.Y = titlebar.Bottom() + GAP; Add(message); var btnWeapon = new RedButton(TxtWeapon); btnWeapon.ClickAction = WeaponClick; btnWeapon.SetRect(0, message.Y + message.Height + GAP, WIDTH, BTN_HEIGHT); Add(btnWeapon); var btnArmor = new RedButton(TxtArmor); btnArmor.ClickAction = ArmorClick; btnArmor.SetRect(0, btnWeapon.Bottom() + GAP, WIDTH, BTN_HEIGHT); Add(btnArmor); Resize(WIDTH, (int)btnArmor.Bottom()); }
public WndTradeItem(Heap heap, bool canBuy) { _heap = heap; var item = heap.Peek(); var pos = CreateDescription(item, true); var price = Price(item); if (canBuy) { var btnBuy = new RedButton(Utils.Format(TxtBuy, price)); btnBuy.ClickAction = BuyAction; btnBuy.SetRect(0, pos + Gap, WIDTH, BtnHeight); btnBuy.Enable(price <= Dungeon.Gold); Add(btnBuy); var btnCancel = new RedButton(TxtCancel); btnCancel.ClickAction = CancelAction; btnCancel.SetRect(0, btnBuy.Bottom() + Gap, WIDTH, BtnHeight); Add(btnCancel); Resize(WIDTH, (int)btnCancel.Bottom()); } else { Resize(WIDTH, (int)pos); } }
async void FlipButton(object sender, EventArgs e) { uint timeout = 500; if (RedButton.IsVisible) { GreenButton.RotationY = -270; await RedButton.RotateYTo(-90, timeout, Easing.SpringIn); RedButton.IsVisible = false; GreenButton.IsVisible = true; await GreenButton.RotateYTo(-360, timeout, Easing.SpringOut); GreenButton.RotationY = 0; } else { RedButton.RotationY = -270; await GreenButton.RotateYTo(-90, timeout, Easing.SpringIn); GreenButton.IsVisible = false; RedButton.IsVisible = true; await RedButton.RotateYTo(-360, timeout, Easing.SpringOut); RedButton.RotationY = 0; } }
void Awake() { doorAnim = gameObject.GetComponent <Animator>(); if (GameObject.FindWithTag("Button")) { redButton = GameObject.FindWithTag("Button").GetComponent <RedButton>(); } }
void Start() { redButton1 = GameObject.Find("Red Button 1"); redButton2 = GameObject.Find("Red Button 2"); redButton3 = GameObject.Find("Red Button 3"); redButtonScript1 = redButton1.GetComponent <RedButton>(); redButtonScript2 = redButton2.GetComponent <RedButton>(); redButtonScript3 = redButton3.GetComponent <RedButton>(); }
public WndItem(WndBag owner, Item item) { var titlebar = new IconTitle(); titlebar.Icon(new ItemSprite(item.image, item.Glowing())); titlebar.Label(Utils.Capitalize(item.ToString())); titlebar.SetRect(0, 0, WIDTH, 0); Add(titlebar); if (item.levelKnown && item.level > 0) { titlebar.Color(ItemSlot.Upgraded); } else if (item.levelKnown && item.level < 0) { titlebar.Color(ItemSlot.Degraded); } var info = PixelScene.CreateMultiline(item.Info(), 6); info.MaxWidth = WIDTH; info.Measure(); info.X = titlebar.Left(); info.Y = titlebar.Bottom() + Gap; Add(info); var y = info.Y + info.Height + Gap; float x = 0; if (Dungeon.Hero.IsAlive && owner != null) { foreach (var action in item.Actions(Dungeon.Hero)) { var btn = new RedButton(action); btn.ClickAction = button => { item.Execute(Dungeon.Hero, action); Hide(); owner.Hide(); }; btn.SetSize(Math.Max(ButtonWidth, btn.ReqWidth()), ButtonHeight); if (x + btn.Width > WIDTH) { x = 0; y += ButtonHeight + Gap; } btn.SetPos(x, y); Add(btn); x += btn.Width + Gap; } } Resize(WIDTH, (int)(y + (x > 0 ? ButtonHeight : 0))); }
public WndBalance(Weapon weapon) { var titlebar = new IconTitle(weapon); titlebar.SetRect(0, 0, WIDTH, 0); Add(titlebar); var tfMesage = PixelScene.CreateMultiline(Utils.Format(TXT_CHOICE, weapon.Name), 8); tfMesage.MaxWidth = WIDTH - MARGIN * 2; tfMesage.Measure(); tfMesage.X = MARGIN; tfMesage.Y = titlebar.Bottom() + MARGIN; Add(tfMesage); var pos = tfMesage.Y + tfMesage.Height; if (weapon.imbue != Weapon.Imbue.Speed) { var btnSpeed = new RedButton(TXT_SPEED); btnSpeed.ClickAction = button => { Hide(); Apply(weapon, true); }; btnSpeed.SetRect(MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT); Add(btnSpeed); pos = btnSpeed.Bottom(); } if (weapon.imbue != Weapon.Imbue.Accuracy) { var btnAccuracy = new RedButton(TXT_ACCURACY); btnAccuracy.ClickAction = button => { Hide(); Apply(weapon, false); }; btnAccuracy.SetRect(MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT); Add(btnAccuracy); pos = btnAccuracy.Bottom(); } var btnCancel = new RedButton(TXT_CANCEL); btnCancel.ClickAction = button => Hide(); btnCancel.SetRect(MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT); Add(btnCancel); Resize(WIDTH, (int)btnCancel.Bottom() + MARGIN); }
public WndBlacksmith(Blacksmith troll, Hero hero) { ItemSelector = new BlacksmithItemSelector(this); var titlebar = new IconTitle(); titlebar.Icon(troll.Sprite); titlebar.Label(Utils.Capitalize(troll.Name)); titlebar.SetRect(0, 0, WIDTH, 0); Add(titlebar); var message = PixelScene.CreateMultiline(TxtPrompt, 6); message.MaxWidth = WIDTH; message.Measure(); message.Y = titlebar.Bottom() + Gap; Add(message); BtnItem1 = new ItemButton(); BtnItem1.ClickAction = () => { BtnPressed = BtnItem1; GameScene.SelectItem(ItemSelector, WndBag.Mode.UPGRADEABLE, TxtSelect); }; BtnItem1.SetRect((WIDTH - BtnGap) / 2 - BtnSize, message.Y + message.Height + BtnGap, BtnSize, BtnSize); Add(BtnItem1); BtnItem2 = new ItemButton(); BtnItem2.ClickAction = () => { BtnPressed = BtnItem2; GameScene.SelectItem(ItemSelector, WndBag.Mode.UPGRADEABLE, TxtSelect); }; BtnItem2.SetRect(BtnItem1.Right() + BtnGap, BtnItem1.Top(), BtnSize, BtnSize); Add(BtnItem2); BtnReforge = new RedButton(TxtReforge); BtnReforge.ClickAction = button => { troll.Upgrade(BtnItem1.Item, BtnItem2.Item); Hide(); }; BtnReforge.Enable(false); BtnReforge.SetRect(0, BtnItem1.Bottom() + BtnGap, WIDTH, 20); Add(BtnReforge); Resize(WIDTH, (int)BtnReforge.Bottom()); }
public WndResurrect(Ankh ankh, object causeOfDeath) { Instance = this; CauseOfDeath = causeOfDeath; var titlebar = new IconTitle(); titlebar.Icon(new ItemSprite(ankh.image, null)); titlebar.Label(ankh.Name); titlebar.SetRect(0, 0, WIDTH, 0); Add(titlebar); var message = PixelScene.CreateMultiline(TxtMessage, 6); message.MaxWidth = WIDTH; message.Measure(); message.Y = titlebar.Bottom() + Gap; Add(message); var btnYes = new RedButton(TxtYes); btnYes.ClickAction = button => { Hide(); Statistics.AnkhsUsed++; InterlevelScene.mode = InterlevelScene.Mode.RESURRECT; Game.SwitchScene <InterlevelScene>(); }; btnYes.SetRect(0, message.Y + message.Height + Gap, WIDTH, BtnHeight); Add(btnYes); var btnNo = new RedButton(TxtNo); btnNo.ClickAction = button => { Hide(); Rankings.Instance.Submit(false); Hero.ReallyDie(causeOfDeath); }; btnNo.SetRect(0, btnYes.Bottom() + Gap, WIDTH, BtnHeight); Add(btnNo); Resize(WIDTH, (int)btnNo.Bottom()); }
/// <summary> /// Aux function to instantiate each Feature subclass /// Fixes the "Web API error: The 'ObjectContent`1' type failed to serialize" Error /// </summary> /// <param name="feature"></param> /// <param name="isNew"></param> /// <returns></returns> private Feature CreateFeature(Feature feature, bool isNew) { Feature featuremodel = new Feature(); switch (feature.FeatureType) { case "BlueButton": if (isNew) { featuremodel = new BlueButton(feature.Name); } else { featuremodel = new BlueButton(feature.Name, feature.FeatureFlag, feature.FeaturePermissions); } break; case "RedButton": if (isNew) { featuremodel = new RedButton(feature.Name); } else { featuremodel = new RedButton(feature.Name, feature.FeatureFlag, feature.FeaturePermissions); } break; case "GreenButton": if (isNew) { featuremodel = new GreenButton(feature.Name); } else { featuremodel = new GreenButton(feature.Name, feature.FeatureFlag, feature.FeaturePermissions); } break; default: return(null); } featuremodel.Id = feature.Id; return(featuremodel); }
public void CalcRectArea() { startTextArea = WhitodoText.TranslatePoint(new Point(0, 0), this); endTextArea.X = startTextArea.X + WhitodoText.Width; endTextArea.Y = startTextArea.Y + WhitodoText.Height; startControlArea = RedButton.TranslatePoint(new Point(0, 0), this); endControlArea = WhitodoButton.TranslatePoint(new Point(0, 0), this); endControlArea.X += WhitodoButton.Width; endControlArea.Y += WhitodoButton.Height; /* DEBUG INFO * string x = "startTextArea=" + startTextArea.X.ToString() + "," + startTextArea.Y.ToString(); * x += "\nendTextArea=" + endTextArea.X.ToString() + "," + endTextArea.Y.ToString(); * x += "\nstartControlArea=" + startControlArea.X.ToString() + "," + startControlArea.Y.ToString(); * x += "\nendControlArea=" + endControlArea.X.ToString() + "," + endControlArea.Y.ToString(); * System.Windows.MessageBox.Show(x); */ }
public StatsTab() { var heroClass = Dungeon.Hero.ClassName(); var title = new IconTitle(); title.Icon(HeroSprite.Avatar(Dungeon.Hero.heroClass, Dungeon.Hero.Tier())); title.Label(Utils.Format(TxtTitle, Dungeon.Hero.Lvl, heroClass).ToUpper(CultureInfo.CurrentCulture)); title.SetRect(0, 0, WIDTH, 0); Add(title); float pos = title.Bottom(); if (Dungeon.Challenges > 0) { var btnCatalogus = new RedButton(TxtChallenges); btnCatalogus.ClickAction = button => Game.Scene.Add(new WndChallenges(Dungeon.Challenges, false)); btnCatalogus.SetRect(0, pos + Gap, btnCatalogus.ReqWidth() + 2, btnCatalogus.ReqHeight() + 2); Add(btnCatalogus); pos = btnCatalogus.Bottom(); } pos += Gap + Gap; pos = StatSlot(this, TxtStr, Dungeon.Hero.STR.ToString(), pos); pos = StatSlot(this, TxtHealth, Dungeon.Hero.HT.ToString(), pos); pos += Gap; pos = StatSlot(this, TxtDuration, ((int)Statistics.Duration).ToString(), pos); pos += Gap; pos = StatSlot(this, TxtDepth, Statistics.DeepestFloor.ToString(), pos); pos = StatSlot(this, TxtEnemies, Statistics.EnemiesSlain.ToString(), pos); pos = StatSlot(this, TxtGold, Statistics.GoldCollected.ToString(), pos); pos += Gap; pos = StatSlot(this, TxtFood, Statistics.FoodEaten.ToString(), pos); pos = StatSlot(this, TxtAlchemy, Statistics.PotionsCooked.ToString(), pos); pos = StatSlot(this, TxtAnkhs, Statistics.AnkhsUsed.ToString(), pos); }
public WndTradeItem(Shopkeeper keeper, Item item, WndBag owner) { _keeper = keeper; _item = item; _owner = owner; var pos = CreateDescription(item, false); if (item.Quantity() == 1) { var btnSell = new RedButton(Utils.Format(TxtSell, item.Price())); btnSell.ClickAction = SellAction; btnSell.SetRect(0, pos + Gap, WIDTH, BtnHeight); Add(btnSell); pos = btnSell.Bottom(); } else { var priceAll = item.Price(); var btnSell1 = new RedButton(Utils.Format(TxtSell1, priceAll / item.Quantity())); btnSell1.ClickAction = SellOneAction; btnSell1.SetRect(0, pos + Gap, WIDTH, BtnHeight); Add(btnSell1); var btnSellAll = new RedButton(Utils.Format(TxtSellAll, priceAll)); btnSellAll.ClickAction = SellAction; btnSellAll.SetRect(0, btnSell1.Bottom() + Gap, WIDTH, BtnHeight); Add(btnSellAll); pos = btnSellAll.Bottom(); } var btnCancel = new RedButton(TxtCancel); btnCancel.ClickAction = CancelAction; btnCancel.SetRect(0, pos + Gap, WIDTH, BtnHeight); Add(btnCancel); Resize(WIDTH, (int)btnCancel.Bottom()); }
public WndOptions(string title, string message, params string[] options) { var tfTitle = PixelScene.CreateMultiline(title, 9); tfTitle.Hardlight(TitleColor); tfTitle.X = tfTitle.Y = Margin; tfTitle.MaxWidth = WIDTH - Margin * 2; tfTitle.Measure(); Add(tfTitle); var tfMesage = PixelScene.CreateMultiline(message, 8); tfMesage.MaxWidth = WIDTH - Margin * 2; tfMesage.Measure(); tfMesage.X = Margin; tfMesage.Y = tfTitle.Y + tfTitle.Height + Margin; Add(tfMesage); var pos = tfMesage.Y + tfMesage.Height + Margin; var i = 0; foreach (var option in options) { var btn = new RedButton(option); btn.Index = 1; btn.ClickAction = (button) => { Hide(); OnSelect(button.Index); }; btn.SetRect(Margin, pos, WIDTH - Margin * 2, ButtonHeight); Add(btn); pos += ButtonHeight + Margin; i++; } Resize(WIDTH, (int)pos); }
void ReleaseDesignerOutlets() { if (BlackButton != null) { BlackButton.Dispose(); BlackButton = null; } if (LastActionTimeLabel != null) { LastActionTimeLabel.Dispose(); LastActionTimeLabel = null; } if (RedButton != null) { RedButton.Dispose(); RedButton = null; } if (RedrawSwitch != null) { RedrawSwitch.Dispose(); RedrawSwitch = null; } if (SizeSlider != null) { SizeSlider.Dispose(); SizeSlider = null; } if (YellowButton != null) { YellowButton.Dispose(); YellowButton = null; } }
public StatsTab(WndHero wndHero) { _wndHero = wndHero; var hero = Dungeon.Hero; var title = PixelScene.CreateText(Utils.Format(TXT_TITLE, hero.Lvl, hero.ClassName()).ToUpper(), 9); title.Hardlight(TitleColor); title.Measure(); Add(title); var btnCatalogus = new RedButton(TXT_CATALOGUS); btnCatalogus.ClickAction = CatalogusClickAction; btnCatalogus.SetRect(0, title.Y + title.Height, btnCatalogus.ReqWidth() + 2, btnCatalogus.ReqHeight() + 2); Add(btnCatalogus); var btnJournal = new RedButton(TXT_JOURNAL); btnJournal.ClickAction = JournalClickAction; btnJournal.SetRect(btnCatalogus.Right() + 1, btnCatalogus.Top(), btnJournal.ReqWidth() + 2, btnJournal.ReqHeight() + 2); Add(btnJournal); pos = btnCatalogus.Bottom() + GAP; StatSlot(TXT_STR, hero.STR); StatSlot(TXT_HEALTH, hero.HP + "/" + hero.HT); StatSlot(TXT_EXP, hero.Exp + "/" + hero.MaxExp()); pos += GAP; StatSlot(TXT_GOLD, Statistics.GoldCollected); StatSlot(TXT_DEPTH, Statistics.DeepestFloor); pos += GAP; }
// -- Standard Operations -- // public Tile CreateTile(String tileName) { switch (tileName.ToLower()) { case "bluebutton": BlueButton blueButton = new BlueButton(); return(blueButton); case "blueflame": BlueFlame blueFlame = new BlueFlame(); return(blueFlame); case "blueplayer": BluePlayer bluePlayer = new BluePlayer(); return(bluePlayer); case "redbutton": RedButton redButton = new RedButton(); return(redButton); case "redflame": RedFlame redFlame = new RedFlame(); return(redFlame); case "redplayer": RedPlayer redPlayer = new RedPlayer(); return(redPlayer); case "wall": Wall wall = new Wall(); return(wall); default: return(null); } }
async void Red_Scaled_Clicked(object sender, EventArgs e) { await RedButton.TranslateTo(-70, 0, 100, Easing.BounceOut); await RedButton.TranslateTo(0, 0); }
public WndSettings(bool inGame) { CheckBox btnImmersive = null; if (inGame) { var w = BtnHeight; _btnZoomOut = new RedButton(TxtZoomOut); _btnZoomOut.ClickAction = button => Zoom(pdsharp.noosa.Camera.Main.Zoom - 1); Add(_btnZoomOut.SetRect(0, 0, w, BtnHeight)); _btnZoomIn = new RedButton(TxtZoomIn); _btnZoomIn.ClickAction = button => Zoom(pdsharp.noosa.Camera.Main.Zoom + 1); Add(_btnZoomIn.SetRect(WIDTH - w, 0, w, BtnHeight)); var btnZoomDefault = new RedButton(TxtZoomDefault); btnZoomDefault.ClickAction = button => Zoom(PixelScene.defaultZoom); btnZoomDefault.SetRect(_btnZoomOut.Right(), 0, WIDTH - _btnZoomIn.Width - _btnZoomOut.Width, BtnHeight); Add(btnZoomDefault); } else { var btnScaleUp = new CheckBox(TxtScaleUp); btnScaleUp.ClickAction = ScaleUpClick; btnScaleUp.SetRect(0, 0, WIDTH, BtnHeight); btnScaleUp.SetChecked(PixelDungeon.ScaleUp()); Add(btnScaleUp); btnImmersive = new CheckBox(TxtImmersive); btnImmersive.ClickAction = ImmersiveClick; btnImmersive.SetRect(0, btnScaleUp.Bottom() + Gap, WIDTH, BtnHeight); btnImmersive.SetChecked(PixelDungeon.Immersed()); btnImmersive.Enable(Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat); Add(btnImmersive); } var btnMusic = new CheckBox(TxtMusic); btnMusic.ClickAction = button => { var checkBox = button as CheckBox; PixelDungeon.Music(checkBox != null && checkBox.Checked()); }; btnMusic.SetRect(0, (btnImmersive != null ? btnImmersive.Bottom() : BtnHeight) + Gap, WIDTH, BtnHeight); btnMusic.SetChecked(PixelDungeon.Music()); Add(btnMusic); var btnSound = new CheckBox(TxtSound); btnSound.ClickAction = SoundClick; btnSound.SetRect(0, btnMusic.Bottom() + Gap, WIDTH, BtnHeight); btnSound.SetChecked(PixelDungeon.SoundFx()); Add(btnSound); if (!inGame) { var btnOrientation = new RedButton(OrientationText()); btnOrientation.ClickAction = OrientationClick; btnOrientation.SetRect(0, btnSound.Bottom() + Gap, WIDTH, BtnHeight); Add(btnOrientation); Resize(WIDTH, (int)btnOrientation.Bottom()); } else { var btnBrightness = new CheckBox(TxtBrightness); btnBrightness.ClickAction = button => { var checkBox = button as CheckBox; PixelDungeon.Brightness(checkBox != null && checkBox.Checked()); }; btnBrightness.SetRect(0, btnSound.Bottom() + Gap, WIDTH, BtnHeight); btnBrightness.SetChecked(PixelDungeon.Brightness()); Add(btnBrightness); Resize(WIDTH, (int)btnBrightness.Bottom()); } }
void ReleaseDesignerOutlets() { if (CleanAllButton != null) { CleanAllButton.Dispose(); CleanAllButton = null; } if (CleanButton != null) { CleanButton.Dispose(); CleanButton = null; } if (DrawView != null) { DrawView.Dispose(); DrawView = null; } if (GreenButton != null) { GreenButton.Dispose(); GreenButton = null; } if (MainView != null) { MainView.Dispose(); MainView = null; } if (MediumButton != null) { MediumButton.Dispose(); MediumButton = null; } if (RedButton != null) { RedButton.Dispose(); RedButton = null; } if (ThickButton != null) { ThickButton.Dispose(); ThickButton = null; } if (ThinButton != null) { ThinButton.Dispose(); ThinButton = null; } if (YellowButton != null) { YellowButton.Dispose(); YellowButton = null; } }
public override void Create() { base.Create(); BitmapTextMultiline text = null; if (!NoText) { text = CreateMultiline(Txt, 8); text.MaxWidth = WIDTH; text.Measure(); Add(text); } _amulet = new Image(Assets.AMULET); Add(_amulet); var btnExit = new RedButton(TxtExit); btnExit.ClickAction = button => { Dungeon.Win(ResultDescriptions.WIN); Dungeon.DeleteGame(Dungeon.Hero.heroClass, true); if (NoText) { Game.SwitchScene <TitleScene>(); } else { Game.SwitchScene <RankingsScene>(); } }; btnExit.SetSize(WIDTH, BtnHeight); Add(btnExit); var btnStay = new RedButton(TxtStay); btnStay.ClickAction = button => OnBackPressed(); btnStay.SetSize(WIDTH, BtnHeight); Add(btnStay); float height; if (NoText) { height = _amulet.Height + LargeGap + btnExit.Height + SmallGap + btnStay.Height; _amulet.X = Align((Camera.Main.CameraWidth - _amulet.Width) / 2); _amulet.Y = Align((Camera.Main.CameraHeight - height) / 2); btnExit.SetPos((Camera.Main.CameraWidth - btnExit.Width) / 2, _amulet.Y + _amulet.Height + LargeGap); btnStay.SetPos(btnExit.Left(), btnExit.Bottom() + SmallGap); } else { height = _amulet.Height + LargeGap + text.Height + LargeGap + btnExit.Height + SmallGap + btnStay.Height; _amulet.X = Align((Camera.Main.CameraWidth - _amulet.Width) / 2); _amulet.Y = Align((Camera.Main.CameraHeight - height) / 2); text.X = Align((Camera.Main.CameraWidth - text.Width) / 2); text.Y = _amulet.Y + _amulet.Height + LargeGap; btnExit.SetPos((Camera.Main.CameraWidth - btnExit.Width) / 2, text.Y + text.Height + LargeGap); btnStay.SetPos(btnExit.Left(), btnExit.Bottom() + SmallGap); } new Flare(8, 48).Color(0xFFDDBB, true).Show(_amulet, 0).AngularSpeed = +30; FadeIn(); }
// Use this for initialization void Start() { redButtonScript = redButton.GetComponent <RedButton>(); }
public override void Create() { base.Create(); Music.Instance.Play(Assets.HAPPY, true); Music.Instance.Volume(1f); uiCamera.Visible = false; var w = pdsharp.noosa.Camera.Main.CameraWidth; var h = pdsharp.noosa.Camera.Main.CameraHeight; var archs = new Archs(); archs.Reversed = true; archs.SetSize(w, h); Add(archs); var vx = Align((w - WIDTH) / 2); var vy = Align((h - HEIGHT) / 2); var s = pdsharp.noosa.Camera.Main.CameraToScreen(vx, vy); _viewport = new pdsharp.noosa.Camera(s.X, s.Y, WIDTH, HEIGHT, defaultZoom); pdsharp.noosa.Camera.Add(_viewport); var window = new Group(); window.Camera = _viewport; Add(window); var dayTime = !Dungeon.NightMode; var sky = new Sky(dayTime); sky.Scale.Set(WIDTH, HEIGHT); window.Add(sky); if (!dayTime) { for (var i = 0; i < Nstars; i++) { var size = pdsharp.utils.Random.Float(); var star = new ColorBlock(size, size, Color.Argb(255, 255, 255, 255)); star.X = pdsharp.utils.Random.Float(WIDTH) - size / 2; star.Y = pdsharp.utils.Random.Float(HEIGHT) - size / 2; star.Am = size * (1 - star.Y / HEIGHT); window.Add(star); } } const float range = HEIGHT * 2 / 3; for (var i = 0; i < Nclouds; i++) { var cloud = new Cloud((Nclouds - 1 - i) * (range / Nclouds) + pdsharp.utils.Random.Float(range / Nclouds), dayTime); window.Add(cloud); } var nPatches = (int)(sky.Width / GrassPatch.WIDTH + 1); for (var i = 0; i < nPatches * 4; i++) { var patch = new GrassPatch((i - 0.75f) * GrassPatch.WIDTH / 4, HEIGHT + 1, dayTime); patch.Brightness(dayTime ? 0.7f : 0.4f); window.Add(patch); } var a = new Avatar(Dungeon.Hero.heroClass); a.X = Align((WIDTH - a.Width) / 2); a.Y = HEIGHT - a.Height + 1; window.Add(a); var pet = new Pet(); pet.Rm = pet.Gm = pet.Bm = 1.2f; pet.X = WIDTH / 2 + 2; pet.Y = HEIGHT - pet.Height; window.Add(pet); if (dayTime) { a.Brightness(1.2f); pet.Brightness(1.2f); } //window.Add(new TouchArea(sky) { protected void OnClick(Touch touch) { pet.Jump(); }; }); for (var i = 0; i < nPatches; i++) { var patch = new GrassPatch((i - 0.5f) * GrassPatch.WIDTH, HEIGHT, dayTime); patch.Brightness(dayTime ? 1.0f : 0.8f); window.Add(patch); } var frame = new Image(Assets.SURFACE); if (!dayTime) { frame.Hardlight(0xDDEEFF); } frame.Frame(0, 0, 88, 125); frame.X = vx - 4; frame.Y = vy - 9; Add(frame); var gameOver = new RedButton("Game Over"); gameOver.ClickAction = GameOverClickAction; gameOver.SetSize(WIDTH - 10, 20); gameOver.SetPos(5 + frame.X + 4, frame.Y + frame.Height + 4); Add(gameOver); Badge.ValidateHappyEnd(); FadeIn(); }
public RedButtonBuilder() { redButton = new RedButton(); }
private void AddButton(RedButton btn) { Add(btn); btn.SetRect(0, _pos > 0 ? _pos += Gap : 0, WIDTH, BtnHeight); _pos += BtnHeight; }
public WndChooseWay(TomeOfMastery tome, HeroSubClass way1, HeroSubClass way2) { var titlebar = new IconTitle(); titlebar.Icon(new ItemSprite(tome.Image, null)); titlebar.Label(tome.Name); titlebar.SetRect(0, 0, WIDTH, 0); Add(titlebar); var hl = new Highlighter(way1.Desc + "\\Negative\\Negative" + way2.Desc + "\\Negative\\Negative" + TxtMessage); var normal = PixelScene.CreateMultiline(hl.Text, 6); normal.MaxWidth = WIDTH; normal.Measure(); normal.X = titlebar.Left(); normal.Y = titlebar.Bottom() + Gap; Add(normal); if (hl.IsHighlighted) { normal.Mask = hl.Inverted(); var highlighted = PixelScene.CreateMultiline(hl.Text, 6); highlighted.MaxWidth = normal.MaxWidth; highlighted.Measure(); highlighted.X = normal.X; highlighted.Y = normal.Y; Add(highlighted); highlighted.Mask = hl.Mask; highlighted.Hardlight(TitleColor); } var btnWay1 = new RedButton(Utils.Capitalize(way1.Title)); btnWay1.ClickAction = button => { Hide(); tome.Choose(way1); }; btnWay1.SetRect(0, normal.Y + normal.Height + Gap, (WIDTH - Gap) / 2, BtnHeight); Add(btnWay1); var btnWay2 = new RedButton(Utils.Capitalize(way2.Title)); btnWay2.ClickAction = button => { Hide(); tome.Choose(way2); }; btnWay2.SetRect(btnWay1.Right() + Gap, btnWay1.Top(), btnWay1.Width, BtnHeight); Add(btnWay2); var btnCancel = new RedButton(TxtCancel); btnCancel.ClickAction = button => Hide(); btnCancel.SetRect(0, btnWay2.Bottom() + Gap, WIDTH, BtnHeight); Add(btnCancel); Resize(WIDTH, (int)btnCancel.Bottom()); }
public WndGame() { var btnSetting = new RedButton(TxtSettings); btnSetting.ClickAction = button => { Hide(); GameScene.Show(new WndSettings(true)); }; AddButton(btnSetting); if (Dungeon.Challenges > 0) { var btnChallenges = new RedButton(TxtChalleges); btnChallenges.ClickAction = button => { Hide(); GameScene.Show(new WndChallenges(Dungeon.Challenges, false)); }; AddButton(btnChallenges); } if (!Dungeon.Hero.IsAlive) { var btnStart = new RedButton(TxtStart); btnStart.ClickAction = StartAction; AddButton(btnStart); btnStart.Icon(Dungeon.Hero.heroClass.Get()); var btnRankings = new RedButton(TxtRankings); btnRankings.ClickAction = RankingsAction; AddButton(btnRankings); } var btnMenu = new RedButton(TxtMenu); btnMenu.ClickAction = button => { try { Dungeon.SaveAll(); } catch (IOException) { } Game.SwitchScene <TitleScene>(); }; AddButton(btnMenu); var btnExit = new RedButton(TxtExit); btnExit.ClickAction = button => Game.Instance.Finish(); AddButton(btnExit); var btnReturn = new RedButton(TxtReturn); btnReturn.ClickAction = button => Hide(); AddButton(btnReturn); Resize(WIDTH, _pos); }