public override void OnButtonClick(ButtonId button) { base.OnButtonClick(button); switch (button) { case ButtonId.User1: pos = 2; if (--currentFunction < 0) { currentFunction = functions.Count - 1; } break; case ButtonId.User2: pos = 2; if (++currentFunction >= CurrentMenu.Count) { currentFunction = 0; } break; case ButtonId.User3: CurrentMenu[currentFunction].Action(); break; } }
protected virtual void RaiseButtonEvent(ButtonId buttonId, bool?value, string deviceName = "") { if (ButtonInput != null) { ButtonInput(this, new DeviceActionEventArgs { Button = buttonId, Value = value, DeviceName = deviceName }); } }
void SetButton(int index, ButtonId buttonId, bool updateId = true) { if (updateId) { panelButtonIds[index] = buttonId; } panelButtons[index].SetSpriteIndex((uint)buttonId); }
public MultiplayerLobbyScreen(ServerInfo serverInfo, ButtonDelegate buttonDelegate, bool isServer) { this.serverInfo = serverInfo; viewsLookup = new Dictionary <NetConnection, ClientInfoView>(); View contentView = new View(512, 363); contentView.alignX = View.ALIGN_CENTER; contentView.x = 0.5f * width; contentView.y = 48; Font font = GetDefaultFont(); contentView.AddView(new View(215, 145)); TextView serverName = new TextView(font, serverInfo.name); serverName.alignX = View.ALIGN_CENTER; serverName.x = 113; serverName.y = 155; contentView.AddView(serverName); clientsView = new View(286, contentView.height); clientsView.alignX = View.ALIGN_MAX; clientsView.x = contentView.width; contentView.AddView(clientsView); AddView(contentView); View buttons = new View(); buttons.x = 0.5f * width; buttons.y = 432; buttons.alignX = View.ALIGN_CENTER; buttons.alignY = View.ALIGN_MAX; Button button = new TempButton("BACK"); button.buttonDelegate = buttonDelegate; button.id = (int)ButtonId.Back; buttons.AddView(button); SetCancelButton(button); String label = isServer ? "START" : "READY"; ButtonId buttonId = isServer ? ButtonId.Start : ButtonId.Ready; button = new TempButton(label); button.buttonDelegate = buttonDelegate; button.id = (int)buttonId; buttons.AddView(button); buttons.LayoutHor(10); buttons.ResizeToFitViews(); AddView(buttons); }
public IButtonAggregator OnPinValueChange(ButtonId button) { if (!buttons.ContainsKey(button)) { Console.WriteLine($"Unrecognized button {button}"); return(this); } return(new ButtonAggregator(this, buttons: buttons.SetItem(button, buttons[button].OnPinValueChange()))); }
private void OnButtonPressed(Button button) { ButtonId buttonId = (ButtonId)button.id; switch (buttonId) { case ButtonId.Back: Finish(); break; } }
public InputButton GetButton(ButtonId id) { foreach (InputButton button in _buttons) { if (button.Id == id) { return(button); } } return(null); }
private static Button <ButtonId> SetupButton( Action <object> pushEvent, GpioHandler gpioHandler, Action <bool> led, int pin, ButtonId id, uint interval = 50) { gpioHandler.RegisterInterruptCallback(pin, () => { pushEvent(new PinValueChangeEvent(id)); }); return(new Button <ButtonId>( () => new Ticker(interval, gpioHandler.Millis), () => !gpioHandler.Read(pin), led, id)); }
public void ChangeSkin() { actualSkin = shoppy.GetComponent <SliderMenu>().choosenSkin; totalOfStars = PlayerPrefs.GetInt("Stars"); ButtonId = EventSystem.current.currentSelectedGameObject.name; ButtonId = ButtonId.Substring(ButtonId.Length - 2); x = int.Parse(ButtonId); if (PlayerPrefs.GetInt(ButtonId) == 0 || PlayerPrefs.GetInt(ButtonId) == -1) { boughtSkin = -1; if (x == actualSkin) { cost = int.Parse(costSkin.text); } else { cost = -1; } } else { boughtSkin = 1; cost = -1; } if (x == actualSkin && totalOfStars >= cost) { x++; if (x < 10) { imageName = "0" + x.ToString(); } else { imageName = x.ToString(); } if (boughtSkin == -1) { PlayerPrefs.SetInt("Stars", totalOfStars - cost); PlayerPrefs.SetInt(ButtonId, 1); PlayerPrefs.SetString("Skin", imageName); } else { PlayerPrefs.SetString("Skin", imageName); } } }
private void OnButtonPress(Button button) { ButtonId buttonId = (ButtonId)button.id; switch (buttonId) { case ButtonId.Cancel: { cancelCallback(); break; } } }
public Vector2 GetAxis(ButtonId buttonId = ButtonId.ButtonSteamVrTouchpad) { switch (buttonId) { case ButtonId.ButtonAxis0: return(new Vector2(State.rAxis0.x, State.rAxis0.y)); // also touchpad case ButtonId.ButtonAxis1: return(new Vector2(State.rAxis1.x, State.rAxis1.y)); // also trigger case ButtonId.ButtonAxis2: return(new Vector2(State.rAxis2.x, State.rAxis2.y)); // hand trigger..? case ButtonId.ButtonAxis3: return(new Vector2(State.rAxis3.x, State.rAxis3.y)); // index joystick case ButtonId.ButtonAxis4: return(new Vector2(State.rAxis4.x, State.rAxis4.y)); } return(Vector2.Zero); }
public void OnScratch(ButtonId _buttonId) { if (MainMenuManager.Instance.IsPageSwitch() || ServerApi.IsExists) { return; } SoundUtil.PlaySE(SEID.SE_MENU_OK); if (TutorialManager.IsExists || MasterDataUtil.IsFirstTimeFree(Context.gachaMaster)) { // チュートリアル& // 初回オタメシは確認ダイアログなし SendScratch(1); return; } //期間チェック if (!MasterDataUtil.CheckActiveGachaMaster(Context.gachaMaster)) { openWarningTermDialog(); return; } //引ける回数チェック int _count = (int)MasterDataUtil.GetGachaCountFromMaster(Context.gachaMaster); if (_count == 0) { openWarningLowDialog(); return; } if (_buttonId == ButtonId.ScratchOne) { //単発 openScratchDialog(1); } else { //連続 openScratchDialog(_count); } }
protected override async Task ProcessCoreAsync(TagHelperContext context, TagHelperOutput output) { output.SuppressOutput(); Action ??= ConfirmType == ConfirmActionType.Delete ? "Delete" : HtmlHelper.ViewContext.RouteData.Values.GetActionName(); Controller ??= HtmlHelper.ViewContext.RouteData.Values.GetControllerName(); var model = new ConfirmModel { ButtonId = ButtonId, FormPostUrl = _urlHelper.Action(Action, Controller), ConfirmType = ConfirmType, // Labels Title = Title, AcceptText = AcceptText ?? (ConfirmType == ConfirmActionType.Delete ? T("Admin.Common.Delete") : T("Common.OK")), CancelText = CancelText ?? (ConfirmType == ConfirmActionType.Delete ? T("Admin.Common.NoCancel") : T("Common.Cancel")), Message = Message ?? (ConfirmType == ConfirmActionType.Delete ? T("Admin.Common.DeleteConfirmation") : T("Admin.Common.AskToProceed")), // Modal setings Backdrop = Backdrop, Center = Center, CenterContent = CenterContent, Size = Size, // Icon class & color IconClass = IconClass ?? GetIconClass(ConfirmType), IconColor = IconColor ?? GetIconColor(ConfirmType), ButtonStyle = ButtonColor ?? GetButtonStyle(ConfirmType) }; if (ViewContext.ViewData.Model is EntityModelBase entityModel && entityModel.Id != 0 && ConfirmType == ConfirmActionType.Delete) { model.Id = entityModel.Id; // TODO: (mc) (core) This is really bad, but sufficient for the moment. model.EntityType = ButtonId.Replace("-delete", string.Empty); } // Render confirm dialog. var partial = await HtmlHelper.PartialAsync("Confirm", model, null); var widget = new HtmlWidgetInvoker(partial); _widgetProvider.RegisterWidget("end", widget); }
public Vector2 GetAxis(ButtonId buttonId = ButtonId.ButtonSteamVrTouchpad) { var axisId = (uint)buttonId - (uint)EVRButtonId.k_EButton_Axis0; switch (axisId) { case 0: return(new Vector2(State.rAxis0.x, State.rAxis0.y)); case 1: return(new Vector2(State.rAxis1.x, State.rAxis1.y)); case 2: return(new Vector2(State.rAxis2.x, State.rAxis2.y)); case 3: return(new Vector2(State.rAxis3.x, State.rAxis3.y)); case 4: return(new Vector2(State.rAxis4.x, State.rAxis4.y)); } return(Vector2.Zero); }
/// <summary> /// Handler for the editors buttons MouseDown event /// </summary> /// <param name="sender">The object that raised the event</param> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public void OnEditorButtonMouseDown(object sender, CellMouseEventArgs e) { this.ParseEditText(); if (e.Y < this.buttonBounds.Top + (this.buttonBounds.Height / 2)) { this.buttonID = ButtonId.UpButtonID; this.UpButton(); } else { this.buttonID = ButtonId.DownButtonID; this.DownButton(); } this.StartTimer(); }
public override void OnButtonClick(ButtonId button) { base.OnButtonClick(button); if (button == ButtonId.User1) { ShowSeconds = !ShowSeconds; } else if (button == ButtonId.User3) { EnableTimer = !EnableTimer; playAlarm = false; showAlarmScreen = EnableTimer ? new TimeSpan(0, 0, 2) : new TimeSpan(0, 0, 0); new System.Threading.Tasks.Task(async() => { while (showAlarmScreen.Seconds > 0) { await System.Threading.Tasks.Task.Delay(1000); showAlarmScreen = showAlarmScreen.Subtract(new TimeSpan(0, 0, 1)); } }).Start(); } pixelRenderer.UpdateConfig(); }
/// <summary> /// Gets the button text for the CurrentUICulture language. /// Note: The fallback language is English /// </summary> /// <param name="buttonId">The ID of the button.</param> /// <returns>The button text</returns> private string GetButtonText(ButtonId buttonId) { var buttonTextArrayIndex = Convert.ToInt32(buttonId); switch (_languageId) { case TwoLetterIsoLanguageId.en: return(ButtonTextsEnglishEn[buttonTextArrayIndex]); case TwoLetterIsoLanguageId.de: return(ButtonTextsGermanDe[buttonTextArrayIndex]); case TwoLetterIsoLanguageId.es: return(ButtonTextsSpanishEs[buttonTextArrayIndex]); case TwoLetterIsoLanguageId.it: return(ButtonTextsItalianIt[buttonTextArrayIndex]); default: return(ButtonTextsEnglishEn[buttonTextArrayIndex]); } }
public override void OnButtonClick(ButtonId button) { base.OnButtonClick(button); switch (ModuleToShow) { case SubModule.Temp: ModuleToShow = SubModule.Humidity; break; case SubModule.Humidity: ModuleToShow = SubModule.Wind; break; case SubModule.Wind: ModuleToShow = SubModule.Pressure; break; case SubModule.Pressure: ModuleToShow = SubModule.Temp; break; } pixelRenderer.UpdateConfig(); }
/// <summary> /// 按钮标题 /// </summary> /// <param name="id"></param> /// <param name="text"></param> public void SetButtonText(ButtonId id, string text) { switch (id) { case ButtonId.Yes: if (null != yesButtonText && null != text) { yesButtonText.text = text; } break; case ButtonId.No: if (null != noButtonText && null != text) { noButtonText.text = text; } break; default: Debuger.LogWarning("SetButtonText -- button_id = " + id + " is illegal."); break; } }
/// <summary> /// Initializes a new instance of the DoubleCellEditor class with default settings /// </summary> public DoubleCellEditor() { TextBox textbox = new TextBox { AutoSize = false, BorderStyle = BorderStyle.None }; this.Control = textbox; this.currentValue = 0; this.increment = 1; this.minimum = 0; this.maximum = 100; this.format = "G"; this.wheelDelta = 0; this.interceptArrowKeys = true; this.userEdit = false; this.changingText = false; this.buttonBounds = Rectangle.Empty; this.buttonID = ButtonId.Undefined; this.interval = TimerInterval; }
/// <summary> /// Crée un contexte d'information sur le bouton /// </summary> /// <param name="id">Identifiant du bouton</param> /// <param name="path">Sprite du bouton (chemin)</param> /// <param name="slot">Slot du bouton</param> public ButtonInfo(ButtonId id, String path, Slot slot) { this._id = id; this._path = path; this._slot = slot; }
private void OnButtonStateChanged(ButtonId buttonId, bool isPressed) { _log.AddEntry(new LogEntry("Device button state changed for button " + buttonId.ToString() + ": " + (isPressed ? "PRESSED" : "NOT PRESSED"))); }
/// <summary> /// Récupère un bouton /// </summary> /// <param name="bid">Identifiant du bouton</param> /// <returns>Le bouton</returns> public static Sprite getButton(ButtonId bid) { int i = 0; for ( ; i < SLOTS && Buttons._buttons[i].Id != (int)bid; ++i); return Buttons._buttons[i].Sprite; }
public IButtonAggregator OnPinValueChange(ButtonId button) { ReceivedButton = button; return(Next); }
public PinValueChangeEvent(ButtonId Button) { this.Button = Button; }
public InputButton(ButtonId id) { Id = id; _pressed = false; }
public bool GetPressUp(ButtonId buttonId) { return(GetPressUp(1ul << (int)buttonId)); }
public InputButton GetButton(ButtonId id) { foreach(InputButton button in _buttons) { if(button.Id == id) return button; } return null; }
void Update() { //BulletTimer Settings if (bulletTime) { if (bulletTimer < 3) { soundScript.ChangePitch(); bulletTimer += Time.deltaTime; } else { soundScript.ResumePitch(); bulletTime = false; bulletTimer = 0; } } //BulletTimer SettingsEnd //Levels Settings //ObjectiveScore-Timer between instanciating Balloons-Loading if (level == 46) { if (!once) { balloonsCuantity = 100000; timerBalloons = 3; loadingSurvivor = true; once = true; } } if (level == 1) { if (!once) { objectiveScore = 500; balloonsCuantity = 30; timerBalloons = 3; loading = true; once = true; } } if (level == 2) { if (!once) { objectiveScore = 750; balloonsCuantity = 35; timerBalloons = 2; loading = true; once = true; } } if (level == 3) { if (!once) { objectiveScore = 1000; balloonsCuantity = 40; timerBalloons = 2; loading = true; once = true; } } if (level == 4) { if (!once) { objectiveScore = 1250; balloonsCuantity = 45; timerBalloons = 2; loading = true; once = true; } } if (level == 5) { if (!once) { objectiveScore = 800; balloonsCuantity = 45; timerBalloons = 1.5f; loading = true; once = true; } } if (level == 6) { if (!once) { objectiveScore = 800; balloonsCuantity = 40; timerBalloons = 2f; loading = true; once = true; } } if (level == 7) { if (!once) { objectiveScore = 1000; balloonsCuantity = 45; timerBalloons = 2f; loading = true; once = true; } } if (level == 8) { if (!once) { objectiveScore = 1000; balloonsCuantity = 40; timerBalloons = 1.5f; loading = true; once = true; } } if (level == 9) { if (!once) { objectiveScore = 1250; balloonsCuantity = 45; timerBalloons = 1.5f; loading = true; once = true; } } if (level == 10) { if (!once) { objectiveScore = 2000; balloonsCuantity = 55; timerBalloons = 1; loading = true; once = true; } } if (level == 11) { if (!once) { objectiveScore = 2000; balloonsCuantity = 50; timerBalloons = 2; loading = true; once = true; } } if (level == 12) { if (!once) { objectiveScore = 2000; balloonsCuantity = 50; timerBalloons = 1.5f; loading = true; once = true; } } if (level == 13) { if (!once) { objectiveScore = 2250; balloonsCuantity = 55; timerBalloons = 2; loading = true; once = true; } } if (level == 14) { if (!once) { objectiveScore = 2250; balloonsCuantity = 55; timerBalloons = 1; loading = true; once = true; } } if (level == 15) { if (!once) { objectiveScore = 2000; balloonsCuantity = 55; timerBalloons = 1; loading = true; once = true; } } if (level == 16) { if (!once) { objectiveScore = 1250; balloonsCuantity = 40; timerBalloons = 2; loading = true; once = true; } } if (level == 17) { if (!once) { objectiveScore = 1250; balloonsCuantity = 35; timerBalloons = 2; loading = true; once = true; } } if (level == 18) { if (!once) { objectiveScore = 1500; balloonsCuantity = 40; timerBalloons = 2; loading = true; once = true; } } if (level == 19) { if (!once) { objectiveScore = 1500; balloonsCuantity = 40; timerBalloons = 1; loading = true; once = true; } } if (level == 20) { if (!once) { objectiveScore = 1250; balloonsCuantity = 35; timerBalloons = 2; loading = true; once = true; } } if (level == 21) { if (!once) { objectiveScore = 1500; balloonsCuantity = 40; timerBalloons = 2; loading = true; once = true; } } if (level == 22) { if (!once) { objectiveScore = 1500; balloonsCuantity = 35; timerBalloons = 2; loading = true; once = true; } } if (level == 23) { if (!once) { objectiveScore = 1500; balloonsCuantity = 40; timerBalloons = 1; loading = true; once = true; } } if (level == 24) { if (!once) { objectiveScore = 1500; balloonsCuantity = 35; timerBalloons = 1; loading = true; once = true; } } if (level == 25) { if (!once) { objectiveScore = 1500; balloonsCuantity = 40; timerBalloons = 2; loading = true; once = true; } } if (level == 26) { if (!once) { objectiveScore = 1750; balloonsCuantity = 40; timerBalloons = 2; loading = true; once = true; } } if (level == 27) { if (!once) { objectiveScore = 1750; balloonsCuantity = 40; timerBalloons = 1; loading = true; once = true; } } if (level == 28) { if (!once) { objectiveScore = 1500; balloonsCuantity = 40; timerBalloons = 1; loading = true; once = true; } } if (level == 29) { if (!once) { objectiveScore = 1750; balloonsCuantity = 45; timerBalloons = 2; loading = true; once = true; } } if (level == 30) { if (!once) { objectiveScore = 1750; balloonsCuantity = 45; timerBalloons = 1; loading = true; once = true; } } if (level == 31) { if (!once) { objectiveScore = 1750; balloonsCuantity = 40; timerBalloons = 1; loading = true; once = true; } } if (level == 32) { if (!once) { objectiveScore = 2000; balloonsCuantity = 50; timerBalloons = 2; loading = true; once = true; } } if (level == 33) { if (!once) { objectiveScore = 2000; balloonsCuantity = 35; timerBalloons = 2; loading = true; once = true; } } if (level == 34) { if (!once) { objectiveScore = 2500; balloonsCuantity = 40; timerBalloons = 2; loading = true; once = true; } } if (level == 35) { if (!once) { objectiveScore = 2500; balloonsCuantity = 40; timerBalloons = 1; loading = true; once = true; } } if (level == 36) { if (!once) { objectiveScore = 2500; balloonsCuantity = 35; timerBalloons = 1; loading = true; once = true; } } if (level == 37) { if (!once) { objectiveScore = 2750; balloonsCuantity = 40; timerBalloons = 2; loading = true; once = true; } } if (level == 38) { if (!once) { objectiveScore = 2750; balloonsCuantity = 40; timerBalloons = 1; loading = true; once = true; } } if (level == 39) { if (!once) { objectiveScore = 2500; balloonsCuantity = 40; timerBalloons = 2; loading = true; once = true; } } if (level == 40) { if (!once) { objectiveScore = 3000; balloonsCuantity = 60; timerBalloons = 2; loading = true; once = true; } } if (level == 41) { if (!once) { objectiveScore = 3000; balloonsCuantity = 55; timerBalloons = 2; loading = true; once = true; } } if (level == 42) { if (!once) { objectiveScore = 3000; balloonsCuantity = 50; timerBalloons = 2; loading = true; once = true; } } if (level == 43) { if (!once) { objectiveScore = 3000; balloonsCuantity = 55; timerBalloons = 1; loading = true; once = true; } } if (level == 44) { if (!once) { objectiveScore = 3000; balloonsCuantity = 45; timerBalloons = 2; loading = true; once = true; } } if (level == 45) { if (!once) { objectiveScore = 3500; balloonsCuantity = 45; timerBalloons = 1; loading = true; once = true; } } //ButtonsLevelsEnd //Pause && Sound if (pause) { pauseOptions.SetActiveRecursively(true); soundScript.StopSound(); Time.timeScale = 0; pauseGo.renderer.material.mainTexture = pauseOn; } else { pauseOptions.SetActiveRecursively(false); if (!soundOnOff) { soundScript.ResumeSound(); } else { soundScript.StopSound(); } if (bulletTime) { Time.timeScale = 0.3f; } else { Time.timeScale = 1; } pauseGo.renderer.material.mainTexture = pauseOff; } if (soundOnOff) { soundInMenu.renderer.material.mainTexture = soundOff; soundButton.renderer.material.mainTexture = soundOff; soundScript.StopSound(); } else { soundInMenu.renderer.material.mainTexture = soundOn; soundButton.renderer.material.mainTexture = soundOn; if (!pause) { soundScript.ResumeSound(); } } //Pause && Sound End //Buttons-Balloons Manipulator if (!pause) { if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.mainCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { //Menu if (hit.collider.gameObject.GetComponent<ButtonId>()) { buttonPressed = hit.collider.gameObject.GetComponent<ButtonId>(); if (buttonPressed.id == "face") { soundScript.PlaySound(19, false, 1f); Application.OpenURL("https://www.facebook.com/pages/Crusher-Balloons/192136817565820"); } if (buttonPressed.id == "twitter") { soundScript.PlaySound(19, false, 1f); Application.OpenURL("https://twitter.com/#!/MG_Developments"); } if (buttonPressed.id == "restart") { soundScript.PlaySound(19, false, 1f); Reset(); } if (buttonPressed.id == "sound") { soundOnOff = !soundOnOff; } if (buttonPressed.id == "okIntro") { Destroy(intro.gameObject); } if (buttonPressed.id == "pause") { pause = !pause; } if (buttonPressed.id == "survivor") { level = buttonPressed.idLevel; highScore = scoreScript.highScoreList[level]; entireMenu.animation.Play("@SurvivorToLoading"); } if (buttonPressed.id == "toMenu") { soundScript.PlaySound(19, false, 1f); level = 0; once = false; gameStarted = false; survivorMode = false; ballonManagerScript.timerEnd = 5; entireMenu.animation.Play("@LoadingToLevels"); Reset(); } if (buttonPressed.id == "toNextLevel") { soundScript.PlaySound(19, false, 1f); gameStarted = false; once = false; Reset(); level++; } if (buttonPressed.id == "play") { soundScript.PlaySound(19, false, 1f); entireMenu.animation.Play("@PlayToLevelSurvivor"); } if (buttonPressed.id == "BackFromHow") { soundScript.PlaySound(20, false, 0.5f); entireMenu.animation.Play("@HowToPlay"); } if (buttonPressed.id == "how") { entireMenu.animation.Play("@PlayToHow"); soundScript.PlaySound(19, false, 1f); } if (buttonPressed.id == "exit") { System.Diagnostics.Process.GetCurrentProcess().Kill(); } if (buttonPressed.id == "levels") { soundScript.PlaySound(19, false, 1f); entireMenu.animation.Play("@LevelsToSelectLevel"); } if (buttonPressed.id == "back1") { soundScript.PlaySound(20, false, 0.5f); entireMenu.animation.Play("@LevelSurvivorToPlay"); } if (buttonPressed.id == "back2") { soundScript.PlaySound(20, false, 0.5f); entireMenu.animation.Play("@SelectLevelsToLevelSurvivor"); } if (buttonPressed.id == "next1") { soundScript.PlaySound(19, false, 1f); levels.animation.Play("@Level1ToLevel2"); back.animation.Play("@BackToLevel2"); inStorm = true; } if (buttonPressed.id == "next2") { soundScript.PlaySound(19, false, 1f); levels.animation.Play("@Level2ToLevel3"); back.animation.Play("@BackToLevel3"); inStorm = false; } if (buttonPressed.id == "backlevel1") { soundScript.PlaySound(20, false, 0.5f); levels.animation.Play("@Level2ToLevel1"); back.animation.Play("@BackToLevel1"); inStorm = false; } if (buttonPressed.id == "backlevel2") { soundScript.PlaySound(20, false, 0.5f); levels.animation.Play("@Level3ToLevel2"); back.animation.Play("@ReturnBack2"); inStorm = true; } ///////levels if (buttonPressed.who == "levels") { entireMenu.animation.Play("@SelectLevelsToLoading"); level = buttonPressed.idLevel; highScore = scoreScript.highScoreList[level]; } } //MenuEnd ///Balloons if (hit.collider.gameObject.layer == 10) { hitObject = hit.collider.gameObject.GetComponent<Balloon>(); if (hitObject.Idballoon == "orange") { Destroy(hit.collider.gameObject.transform.root.gameObject); GameObject particleProv = (GameObject)GameObject.Instantiate(particle); particleProv.transform.position = hitObject.transform.position; particleProv.renderer.material.mainTexture = particleTexture[0]; } if (hitObject.Idballoon == "bullet") { bulletTime = true; Destroy(hit.collider.gameObject.transform.root.gameObject); } if (hitObject.Idballoon == "black") { Camera.mainCamera.animation.Play("@CameraShakeLight"); if (multiply >= 5 && multiply < 7) { this.animation.CrossFade("@CameraShakingLight"); } if (multiply >= 7 && multiply < 10) { this.animation.CrossFade("@CameraShakingHeavy"); } if (multiply >= 10) { this.animation.CrossFade("@CameraShakingSuperHeavy"); } bombScript = hit.collider.gameObject.GetComponentInChildren<BombScript>(); bombChild = hit.collider.gameObject.GetComponent<BombGetChildren>(); hitObject.renderer.enabled = false; bombScript.timerBomb = 10; bombChild.sphereCollider.radius = 4; bombArrayLength = bombScript.arrayList.Length-1; for (int i = bombArrayLength; 0 <= i; i--) { if (bombScript.arrayList != null) { Destroy(bombScript.arrayList[i].gameObject); scoreScript.SurvivorDestroyed(); } } bombScript.thisMesh.renderer.enabled = false; GameObject particleBoom1 = (GameObject)GameObject.Instantiate(particleBoom); particleBoom1.transform.position = hitObject.transform.position; Destroy(hit.collider.gameObject.transform.root.gameObject,0.1f); } if (hitObject.Idballoon == "eater") { Destroy(hit.collider.gameObject.transform.root.gameObject); } if (hitObject.Idballoon == "theray") { particleGreen2 = (GameObject)GameObject.Instantiate(particleGreen); particleGreen2.transform.position = hitObject.transform.position; particleGreen2.renderer.material.mainTexture = yellowParticle; if (hitObject.randomRayColor == 0) { ballonManagerScript.DestroyAllRed(); } else { if (hitObject.randomRayColor == 1) { ballonManagerScript.DestroyAllGreen(); } else { if (hitObject.randomRayColor == 2) { ballonManagerScript.DestroyAllBlue(); } else { if (hitObject.randomRayColor == 3) { ballonManagerScript.DestroyAllYellow(); } } } } scoreScript.PlusScore(ballonManagerScript.calculationScore, 1); ballonManagerScript.calculationScore = 0; Destroy(hit.collider.gameObject.transform.root.gameObject); } } if (hit.collider.gameObject.layer == 9) { hitObject = hit.collider.gameObject.GetComponent<Balloon>(); GameObject particleProv = (GameObject)GameObject.Instantiate(particle); particleProv.transform.position = hitObject.transform.position; if (gameStarted||survivorMode) { particleGreen2 = (GameObject)GameObject.Instantiate(particleGreen); particleGreen2.transform.position = hitObject.transform.position; } if (hitObject.Idballoon == "red") { particleProv.renderer.material.mainTexture = particleTexture[0]; } if (hitObject.Idballoon == "blue") { particleProv.renderer.material.mainTexture = particleTexture[1]; } if (hitObject.Idballoon == "green") { particleProv.renderer.material.mainTexture = particleTexture[2]; } if (hitObject.Idballoon == "yellow") { particleProv.renderer.material.mainTexture = particleTexture[3]; } if (hitObject.Idballoon == "joker") { if (provisorio == "red" || provisorio == "blue" || provisorio == "yellow" || provisorio == "green" || provisorio != null) { hitObject.Idballoon = provisorio; } else { if (gameStarted || survivorMode) { GameObject scoreFeedbackProv = (GameObject)GameObject.Instantiate(scoreFeedback); scoreFeedbackProv.renderer.material.mainTexture = scoreFeedbackTextures[0]; scoreFeedbackProv.transform.position = hit.collider.gameObject.transform.position; scoreFeedbackProv.animation.Play("@ScoreFeedback"); multiply = 1; scoreScript.PlusScore(10, multiply); } } } if (hitObject.Idballoon == "incognit") { if (gameStarted || survivorMode) { randomIncognit = Random.Range(0, 3); if (randomIncognit == 0) { particleGreen2 = (GameObject)GameObject.Instantiate(particleGreen); particleGreen2.transform.position = hitObject.transform.position; GameObject scoreFeedbackProv = (GameObject)GameObject.Instantiate(scoreFeedback); scoreFeedbackProv.renderer.material.mainTexture = scoreFeedbackTextures[0]; scoreFeedbackProv.transform.position = hit.collider.gameObject.transform.position; scoreFeedbackProv.animation.Play("@ScoreFeedback"); multiply = 1; scoreScript.PlusScore(10, multiply); } else { if (randomIncognit == 1) { particleGreen2 = (GameObject)GameObject.Instantiate(particleGreen); particleGreen2.transform.position = hitObject.transform.position; if (provisorio == "red" || provisorio == "blue" || provisorio == "yellow" || provisorio == "green" || provisorio != null) { hitObject.Idballoon = provisorio; } else { GameObject scoreFeedbackProv = (GameObject)GameObject.Instantiate(scoreFeedback); scoreFeedbackProv.renderer.material.mainTexture = scoreFeedbackTextures[0]; scoreFeedbackProv.transform.position = hit.collider.gameObject.transform.position; scoreFeedbackProv.animation.Play("@ScoreFeedback"); multiply = 1; scoreScript.PlusScore(10, multiply); } } else { if (randomIncognit == 2) { soundScript.PlaySound(31, false, 0.7f); GameObject particleBoom1 = (GameObject)GameObject.Instantiate(particleBoom); particleBoom1.transform.position = hitObject.transform.position; for (int i = hitObject.arrayList.Length - 1; 0 <= i; i--) { if (hitObject.arrayList != null) { Destroy(hitObject.arrayList[i].gameObject); scoreScript.SurvivorDestroyed(); } } scoreScript.PlusScore(-10, multiply); } } } } if (gameStarted || survivorMode) { if (hitObject.Idballoon == "incognit" && randomIncognit == 2) { particleGreen2.renderer.material.mainTexture = redTxt; } else { particleGreen2.renderer.material.mainTexture = greenTxt; } } Destroy(hit.collider.gameObject.transform.root.gameObject, 0.1f); } if (hitObject.Idballoon == "red" || hitObject.Idballoon == "blue" || hitObject.Idballoon == "green" || hitObject.Idballoon == "yellow") { if (gameStarted || survivorMode) { if (provisorio == "") { GameObject scoreFeedbackProv = (GameObject)GameObject.Instantiate(scoreFeedback); scoreFeedbackProv.renderer.material.mainTexture = scoreFeedbackTextures[0]; scoreFeedbackProv.transform.position = hit.collider.gameObject.transform.position; scoreFeedbackProv.animation.Play("@ScoreFeedback"); multiply = 1; provisorio = hitObject.Idballoon; scoreScript.PlusScore(10, multiply); } else { if (provisorio == hitObject.Idballoon) { GameObject scoreFeedbackProv = (GameObject)GameObject.Instantiate(scoreFeedback); scoreFeedbackProv.transform.position = hit.collider.gameObject.transform.position; scoreFeedbackProv.animation.Play("@xScore"); multiply++; if (multiply == 2) { scoreFeedbackProv.renderer.material.mainTexture = scoreFeedbackTextures[1]; } if (multiply == 3) { soundScript.PlaySound(22, false, 1); GameObject feedBack = (GameObject)GameObject.Instantiate(feedback[0]); feedBack.transform.position = feedbackPos.transform.position; this.animation.Play("@CameraShakeLight"); scoreFeedbackProv.renderer.material.mainTexture = scoreFeedbackTextures[2]; } if (multiply == 4) { this.animation.Play("@CameraShakeLight"); scoreFeedbackProv.renderer.material.mainTexture = scoreFeedbackTextures[3]; } if (multiply == 5) { soundScript.PlaySound(23, false, 1); GameObject great = (GameObject)GameObject.Instantiate(feedback[1]); great.transform.position = feedbackPos.transform.position; this.animation.CrossFade("@CameraShakingLight"); scoreFeedbackProv.renderer.material.mainTexture = scoreFeedbackTextures[4]; } if (multiply == 6) { this.animation.CrossFadeQueued("@CameraShakingLight"); scoreFeedbackProv.renderer.material.mainTexture = scoreFeedbackTextures[5]; } if (multiply == 7) { soundScript.PlaySound(28, false, 1); GameObject awesome = (GameObject)GameObject.Instantiate(feedback[2]); awesome.transform.position = feedbackPos.transform.position; this.animation.CrossFade("@CameraShakingHeavy"); scoreFeedbackProv.renderer.material.mainTexture = scoreFeedbackTextures[6]; } if (multiply == 8) { this.animation.CrossFade("@CameraShakingHeavy"); scoreFeedbackProv.renderer.material.mainTexture = scoreFeedbackTextures[7]; } if (multiply == 9) { this.animation.CrossFade("@CameraShakingHeavy"); scoreFeedbackProv.renderer.material.mainTexture = scoreFeedbackTextures[8]; } if (multiply >= 10) { soundScript.PlaySound(29, false, 1); GameObject perfect = (GameObject)GameObject.Instantiate(feedback[3]); perfect.transform.position = feedbackPos.transform.position; this.animation.CrossFade("@CameraShakingSuperHeavy"); multiply = 10; scoreFeedbackProv.renderer.material.mainTexture = scoreFeedbackTextures[9]; } scoreScript.PlusScore(10, multiply); } else { if (provisorio != hitObject.Idballoon) { provisorio = hitObject.Idballoon; this.animation.CrossFade("@CameraIdle"); GameObject scoreFeedbackProv = (GameObject)GameObject.Instantiate(scoreFeedback); scoreFeedbackProv.renderer.material.mainTexture = scoreFeedbackTextures[0]; scoreFeedbackProv.transform.position = hit.collider.gameObject.transform.position; scoreFeedbackProv.animation.Play("@ScoreFeedback"); multiply = 1; scoreScript.PlusScore(10, multiply); } } } } } Destroy(hit.collider.gameObject.transform.root.gameObject); } ///BalloonsEnd } } } else { //I do an else cause if pause is true i cant cast ray, so the only things that i can catch we my ray in pause is one of the optionsButtons //OptionsSelection if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.mainCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { buttonPressed = hit.collider.gameObject.GetComponent<ButtonId>(); if (buttonPressed != null) { if (buttonPressed.id == "pause") { pause = !pause; } if (buttonPressed.id == "restart") { pause = false; soundScript.PlaySound(19, false, 1f); Reset(); } if (buttonPressed.id == "toMenu") { pause = false; soundScript.PlaySound(19, false, 1f); level = 0; once = false; gameStarted = false; survivorMode = false; ballonManagerScript.timerEnd = 5; entireMenu.animation.Play("@LoadingToLevels"); Reset(); } if (buttonPressed.id == "sound") { soundOnOff = !soundOnOff; } } } } } //Loadings (Levels or Survivor) if (loadingSurvivor) { if (waiting < 3) { waiting += Time.deltaTime; } else { //I show a little help or feedback about the special balloon-how to play if (!onceHelp) { help1 = (GameObject)GameObject.Instantiate(help); help1.transform.position = helpPos.position; help1.renderer.material.mainTexture = helpTxt[9]; onceHelp = true; } //Do i pressed the ok button of the help? Yes-Get ready to play if (buttonPressed.id == "ok") { soundScript.PlaySound(19, false, 1f); prepare = (GameObject)GameObject.Instantiate(feedback[4]); prepare.transform.position = feedbackPos.transform.position; help1.animation.Play("@HelpOut"); Destroy(help1.gameObject, 1); Destroy(clouds.gameObject); clouds = (GameObject)GameObject.Instantiate(menuDeco); clouds.transform.position = cloudsPos.position; waiting = 0; scoreScript.survivorEnd = 0; loadingSurvivor = false; survivorMode = true; } } } if (loading) { if (waiting < 3) { waiting += Time.deltaTime; } else { //I show a little help or feedback about the special balloon-how to play (Depending the level) if (level == 1 || level == 5||level==10||level==15||level==16||level==20||level==25||level==30||level==35) { if (!onceHelp) { help1 = (GameObject)GameObject.Instantiate(help); help1.transform.position = helpPos.position; if (level == 1) { help1.renderer.material.mainTexture = helpTxt[0]; } if (level == 5) { help1.renderer.material.mainTexture = helpTxt[1]; } if (level == 10) { help1.renderer.material.mainTexture = helpTxt[2]; } if (level == 15) { help1.renderer.material.mainTexture = helpTxt[3]; } if (level == 16) { help1.renderer.material.mainTexture = helpTxt[6]; } if (level == 20) { help1.renderer.material.mainTexture = helpTxt[4]; } if (level == 25) { help1.renderer.material.mainTexture = helpTxt[5]; } if (level == 30) { help1.renderer.material.mainTexture = helpTxt[7]; } if (level == 35) { help1.renderer.material.mainTexture = helpTxt[8]; } onceHelp = true; } //Do i pressed the ok button of the help? Yes-Get ready to play if (buttonPressed.id == "ok") { soundScript.PlaySound(19, false, 1f); prepare = (GameObject)GameObject.Instantiate(feedback[4]); prepare.transform.position = feedbackPos.transform.position; help1.animation.Play("@HelpOut"); Destroy(help1.gameObject, 1); Destroy(clouds.gameObject); clouds = (GameObject)GameObject.Instantiate(menuDeco); clouds.transform.position = cloudsPos.position; waiting = 0; scoreScript.totalBallonsDestroyed = 0; loading = false; gameStarted = true; } } else { prepare = (GameObject)GameObject.Instantiate(feedback[4]); prepare.transform.position = feedbackPos.transform.position; Destroy(clouds.gameObject); clouds = (GameObject)GameObject.Instantiate(menuDeco); clouds.transform.position = cloudsPos.position; waiting = 0; scoreScript.totalBallonsDestroyed = 0; loading = false; gameStarted = true; } } } //When the menu can be seen? if (gameStarted||survivorMode) { soundInMenu.renderer.enabled = false; soundInMenu.collider.enabled = false; if (!scoreScript.showingScore) { pauseGo.renderer.enabled = true; pauseGo.collider.enabled = true; } else { pauseGo.renderer.enabled = false; pauseGo.collider.enabled = false; } soundScript._channels[0].mute = true; if (!pause && !soundOnOff) { soundScript._channels[1].volume = 0.1f; } else { soundScript._channels[1].volume = 0; } entireMenu.SetActiveRecursively(false); } else { soundInMenu.renderer.enabled = true; soundInMenu.collider.enabled = true; pauseGo.renderer.enabled = false; pauseGo.collider.enabled = false; if (!onceSound) { onceSound = true; } if (!pause&&!soundOnOff) { soundScript._channels[0].volume = 0.1f; } soundScript._channels[1].volume = 0; entireMenu.SetActiveRecursively(true); } }
void Update() { if (newgame.activeSelf == false) //gameOptions.SetActive(true); { StartCoroutine(NewGame()); } else if (aboutgame.activeSelf == false) { StartCoroutine(About()); } else if (QuitGame.activeSelf == false) { Quit(); } if (ClassicMood.activeSelf == false) { StartCoroutine(Classic()); } else if (ArcadeMood.activeSelf == false) { StartCoroutine(Arcade()); } else if (exitmood.activeSelf == false) { StartCoroutine(Exit()); } if (Input.GetMouseButtonDown(0)) { Ray ray; ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { if (hit.collider.gameObject.GetComponent <ButtonId>()) { buttonpressed = hit.collider.gameObject.GetComponent <ButtonId>(); // if(buttonpressed.id=="newgame") // { // gameOptions.SetActive(true); // } // if(buttonpressed.id=="quit") // { // messageBox.SetActive(true); // // } // if(buttonpressed.id=="about") // { // about.SetActive(true); // } if (buttonpressed.id == "backhome") { about.SetActive(false); MainScreen.SetActive(true); } // if(buttonpressed.id=="classic") // { // Application.LoadLevel("Classic"); // } // else if(buttonpressed.id=="arcade") // { // Application.LoadLevel("Arcade"); // } if (buttonpressed.id == "yes") { Application.Quit(); } else if (buttonpressed.id == "no") { messageBox.SetActive(false); newgame.tag = "freze"; aboutgame.tag = "frenzy"; QuitGame.tag = "bomb"; } if (buttonpressed.id == "facebook") { Application.OpenURL("https://www.facebook.com/multichoiceapps"); } if (buttonpressed.id == "twitter") { Application.OpenURL("https://twitter.com/multichoiceapps"); } if (buttonpressed.id == "sound") { //Application.OpenURL("https://www.facebook.com/multichoiceapps"); isactive = !isactive; cross.SetActive(isactive); AudioListener.pause = isactive; } } } } if (Input.GetKeyDown(KeyCode.Escape)) { messageBox.SetActive(true); } }
public bool GetTouchUp(ButtonId buttonId) { return(GetTouchUp(1ul << (int)buttonId)); }
/// <summary> /// Handler for the editors buttons MouseUp event /// </summary> /// <param name="sender">The object that raised the event</param> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public void OnEditorButtonMouseUp(object sender, CellMouseEventArgs e) { this.StopTimer(); this.buttonID = ButtonId.Undefined; }
void Update() { if (Input.GetMouseButtonDown(0)) { Ray ray; ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { if (hit.collider.gameObject.GetComponent <ButtonId>()) { buttonpressed = hit.collider.gameObject.GetComponent <ButtonId>(); if (buttonpressed.id == "pause") { //GameObject.Find("FruitDispenser").GetComponent<BoxCollider>().active=false; //pause=!pause; Time.timeScale = 0; AudioListener.pause = true; //Pause(); buttonsOnPause.SetActive(true); pauseinfo.SetActive(false); } if (buttonpressed.id == "play") { if (GameObject.Find("MainScripts").GetComponent <MouseControl>().isfrezed == true) { Time.timeScale = 0.5f; } else { Time.timeScale = 1; } if (StartScreen.isactive == true) { AudioListener.pause = true; } else { AudioListener.pause = false; } //Pause(); buttonsOnPause.SetActive(false); pauseinfo.SetActive(true); } else if (buttonpressed.id == "replay") { //pause=!pause; Application.LoadLevel(Application.loadedLevel); Time.timeScale = 1; //AudioListener.pause=false; } if (buttonpressed.id == "home") { if (StartScreen.isactive == true) { AudioListener.pause = true; } else { AudioListener.pause = false; } Application.LoadLevel("Start"); Time.timeScale = 1; } } } } if (Input.GetKeyDown(KeyCode.Escape)) { //pause=!pause; Time.timeScale = 0; AudioListener.pause = true; //Pause(); buttonsOnPause.SetActive(true); pauseinfo.SetActive(false); } }
void LateUpdate() { guiPoints.GetComponent <EasyFontTextMesh>().Text = mouseControl.points.ToString(); if (done && !completed) { //PlayerPrefs.SetInt("highScore", 0); //Debug.Log(best); //Debug.Log(mouseControl.points); //Debug.Log("The value of key 'highscoreCurrentRounds' is: " + PlayerPrefs.GetInt("highscoreCurrent")); GameObject.Find("Trail").SetActive(false); GameObject.Find("FruitDispenser").GetComponent <FruitDispenser>().pause = true; //GetComponent<Frenzy>().pause=true; completed = true; if (Application.loadedLevelName == "Arcade") { PlayerPrefs.SetInt("arcadeHighScore", MouseControl.arcadeHighScore); GameObject.Find("MainScripts").GetComponent <Timer>().EndTimer(); scores.GetComponent <EasyFontTextMesh>().Text = guiPoints.GetComponent <EasyFontTextMesh>().Text; HighScores.GetComponent <EasyFontTextMesh>().Text = MouseControl.arcadeHighScore.ToString(); } else if (Application.loadedLevelName == "Classic") { PlayerPrefs.SetInt("classicHighScore", MouseControl.classicHighScore); scores.GetComponent <EasyFontTextMesh>().Text = guiPoints.GetComponent <EasyFontTextMesh>().Text; HighScores.GetComponent <EasyFontTextMesh>().Text = MouseControl.classicHighScore.ToString(); } GameObject.Find("GUI").SetActive(false); //finishedGUI.SetActive(true); StartCoroutine(PrepareRoutine()); GetComponent <MouseControl>().enabled = false; if (frenzy.activeSelf == true) { frenzy.SetActive(false); fruit.SetActive(false); //GameObject.Find("FruitDispenser").GetComponent<FruitDispenser>().pause = true; } //GetComponent<Frenzy>().enabled = false; //GameObject.Find("FinishedGUI/Timer").GetComponent<GUIText>().text = "Points : "+mouseControl.points.ToString(); } else if (completed == true) { if (Input.GetMouseButtonDown(0)) { Ray ray; ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { if (hit.collider.gameObject.GetComponent <ButtonId>()) { buttonpressed = hit.collider.gameObject.GetComponent <ButtonId>(); } if (buttonpressed.id == "retry") { //pause=!pause; Application.LoadLevel(Application.loadedLevel); Time.timeScale = 1; //AudioListener.pause=false; } if (buttonpressed.id == "exit") { //pause=!pause; Application.LoadLevel("Start"); //Time.timeScale=1; //AudioListener.pause=false; } } } } }