// Use this for initialization void Start () { _instance = this; state = WheelMode.none; golds = 10; frame = 0; wheel_btn.onClick.AddListener (WheelClick); back_btn.onClick.AddListener (new UnityAction (() => { MainScript.Instance.OpenMenu (true); })); if (!PlayerPrefs.HasKey ("lastWheel")) PlayerPrefs.SetString ("lastWheel", "0"); Worning.FindChild ("ok_btn").GetComponent<Button> ().onClick.AddListener (new UnityAction (() => { Worning.gameObject.SetActive(false); })); Sorry.FindChild ("ok_btn").GetComponent<Button> ().onClick.AddListener (new UnityAction (() => { Sorry.gameObject.SetActive(false); MainScript.Instance.OpenMenu(); })); InitStartArr (); }
public void Init(String type, Boolean bubbles, Boolean cancelable, IWindow view, Int32 detail, Int32 screenX, Int32 screenY, Int32 clientX, Int32 clientY, MouseButton button, IEventTarget target, String modifiersList, Double deltaX, Double deltaY, Double deltaZ, WheelMode deltaMode) { Init(type, bubbles, cancelable, view, detail, screenX, screenY, clientX, clientY, modifiersList.IsCtrlPressed(), modifiersList.IsAltPressed(), modifiersList.IsShiftPressed(), modifiersList.IsMetaPressed(), button, target); DeltaX = deltaX; DeltaY = deltaY; DeltaZ = deltaZ; DeltaMode = deltaMode; }
public override string ToString() { return(String.Format("Button 1: {0,16}, Button 2: {1,16}, Wheel Mode: {2,7}, Wheel: {3,4}, On: {4,5}", Button1.ToString(), Button2.ToString(), WheelMode.ToString(), Wheel.ToString(), On.ToString())); }
//! \endcond // ------------------- public TouchSteeringWheel() : base() { this.analogConfig = new AnalogConfig(); this.analogConfig.analogDeadZone = 0.0f; this.touchSmoothing = 0.1f; this.centerOnDirectTouch = false; this.centerWhenFollowing = false; this.wheelMode = WheelMode.Swipe; this.pressBinding = new DigitalBinding(); this.analogTurnBinding = new AxisBinding("Horizontal", false); this.turnLeftBinding = new DigitalBinding(KeyCode.None, true, "Horizontal", true, false); this.turnRightBinding = new DigitalBinding(KeyCode.None, true, "Horizontal", false, false); this.emulateTouchPressure = true; this.touchPressureBinding = new AxisBinding(); }
public static async Task SetMode(WheelMode newMode, long guildId, DiscordContext context = null, bool save = true) { var dispose = context == null; if (context == null) { #pragma warning disable IDE0068 // Use recommended dispose pattern context = new DiscordContext(); #pragma warning restore IDE0068 // Use recommended dispose pattern } WheelSetting wheelSetting = await context.WheelSetting.FindAsync(guildId); if (wheelSetting == null) { wheelSetting = new WheelSetting() { GuildId = guildId, Mode = (int)newMode }; context.WheelSetting.Add(wheelSetting); } else { wheelSetting.Mode = (int)newMode; } if (save) { await context.SaveChangesAsync(); } if (dispose) { context.Dispose(); } }
/// <summary> /// Creates a new event and initializes it. /// </summary> /// <param name="type">The type of the event.</param> /// <param name="bubbles">If the event is bubbling.</param> /// <param name="cancelable">If the event is cancelable.</param> /// <param name="view">Sets the associated view for the UI event.</param> /// <param name="detail">Sets the detail id for the UI event.</param> /// <param name="screenX">Sets the screen X coordinate.</param> /// <param name="screenY">Sets the screen Y coordinate.</param> /// <param name="clientX">Sets the client X coordinate.</param> /// <param name="clientY">Sets the client Y coordinate.</param> /// <param name="button">Sets which button has been pressed.</param> /// <param name="target">The target of the mouse event.</param> /// <param name="modifiersList">A list with keyboard modifiers that have been pressed.</param> /// <param name="deltaX">The mouse wheel delta in X direction.</param> /// <param name="deltaY">The mouse wheel delta in Y direction.</param> /// <param name="deltaZ">The mouse wheel delta in Z direction.</param> /// <param name="deltaMode">The delta mode for the wheel event.</param> public WheelEvent(String type, Boolean bubbles, Boolean cancelable, IWindow view, Int32 detail, Int32 screenX, Int32 screenY, Int32 clientX, Int32 clientY, MouseButton button, IEventTarget target, String modifiersList, Double deltaX, Double deltaY, Double deltaZ, WheelMode deltaMode) { Init(type, bubbles, cancelable, view, detail, screenX, screenY, clientX, clientY, button, target, modifiersList, deltaX, deltaY, deltaZ, deltaMode); }
public WheelEvent(String type, Boolean bubbles = false, Boolean cancelable = false, IWindow view = null, Int32 detail = 0, Int32 screenX = 0, Int32 screenY = 0, Int32 clientX = 0, Int32 clientY = 0, MouseButton button = MouseButton.Primary, IEventTarget target = null, String modifiersList = null, Double deltaX = 0.0, Double deltaY = 0.0, Double deltaZ = 0.0, WheelMode deltaMode = WheelMode.Pixel) { Init(type, bubbles, cancelable, view, detail, screenX, screenY, clientX, clientY, button, target, modifiersList ?? String.Empty, deltaX, deltaY, deltaZ, deltaMode); }
public static Task SetMode(WheelMode newMode, ulong guildId, DiscordContext context = null, bool save = true) { return(SetMode(newMode, Convert.ToInt64(guildId), context, save)); }
// Update is called once per frame void Update () { if (state == WheelMode.starting) { frame++; if (frame > Sarr[15]) { frame = 0; state = WheelMode.defaulting; } Wheel.sprite = GetStarting(frame); } if (state == WheelMode.defaulting) { frame++; if (frame > (mainAnimation.Count - 1) ) { frame = 0; currentCycle++; } if (currentCycle > cycles) state = WheelMode.finishing; Wheel.sprite = mainAnimation [frame]; } if (state == WheelMode.finishing) { frame++; if (frame > Earr [EndingAnimation.Count - 1]) { state = WheelMode.finished; Wheel_ended (); } Wheel.sprite = GetEnding(frame); } }
void Wheel_ended(){ state = WheelMode.none; wheel_btn.gameObject.SetActive (false); wheel_btn.interactable = true; watch_btn.gameObject.SetActive (true); switch (result) { case WheelMode.gold: TadamScript.Instance.reward = TadamScript.Instance.rewards [0]; if (!string.IsNullOrEmpty (MainScript.Instance.login)) StartCoroutine (MainScript.Instance.Purchase (golds, PurchaseFrom.Wheel)); else MainScript.Instance.Gold_int += golds; break; case WheelMode.shu1: TadamScript.Instance.reward = TadamScript.Instance.rewards [1]; MainScript.Instance.upgrades ["shu1"]++; PlayerPrefs.SetInt ("shu1", MainScript.Instance.upgrades ["shu1"]); break; case WheelMode.shu2: TadamScript.Instance.reward = TadamScript.Instance.rewards [2]; MainScript.Instance.upgrades ["shu2"]++; PlayerPrefs.SetInt ("shu2", MainScript.Instance.upgrades ["shu2"]); break; case WheelMode.shu3: TadamScript.Instance.reward = TadamScript.Instance.rewards [3]; MainScript.Instance.upgrades ["shu3"]++; PlayerPrefs.SetInt ("shu3", MainScript.Instance.upgrades ["shu3"]); break; case WheelMode.suu1: TadamScript.Instance.reward = TadamScript.Instance.rewards [4]; MainScript.Instance.upgrades ["suu1"]++; PlayerPrefs.SetInt ("suu1", MainScript.Instance.upgrades ["suu1"]); break; case WheelMode.suu2: TadamScript.Instance.reward = TadamScript.Instance.rewards [5]; MainScript.Instance.upgrades ["suu2"]++; PlayerPrefs.SetInt ("suu2", MainScript.Instance.upgrades ["suu2"]); break; default: break; } TadamScript.Instance.gameObject.SetActive (true); TadamScript.Instance.ShowTime (LanguageScript.Instance.tadam6); InitWindow (); }
void WheelClick(){ wheel_btn.interactable = false; List<WheelMode> rl = new List<WheelMode> () { WheelMode.gold, WheelMode.shu1, WheelMode.shu2, WheelMode.shu3, WheelMode.suu1, WheelMode.suu2 }; currentCycle = 0; System.Random r = new System.Random (); int ir = r.Next (0,100); int i = (ir % 20 == 0)? r.Next (1,6) : 0; //EndingAnimation = GetLast (rl[UnityEngine.Random.Range (0, 5)]); result = rl[i]; EndingAnimation = GetLast (result); state = WheelMode.starting; }
List<Sprite> GetLast(WheelMode mode) { List<Sprite> result = new List<Sprite> (); List<int> array = new List<int> (); switch (mode) { case WheelMode.gold: array = new List<int> { 13, 14, 15, 0, 1, 2, 3 }; break; case WheelMode.shu1: array = new List<int> { 10,11,12,13,14,15,0 }; break; case WheelMode.shu2: array = new List<int> { 7,8,9,10,11,12,13 }; break; case WheelMode.shu3: array = new List<int> { 5,6,7,8,9,10,11 }; break; case WheelMode.suu1: array = new List<int> { 2,3,4,5,6,7,8 }; break; case WheelMode.suu2: array = new List<int> { 15,0,1,2,3,4,5 }; break; default: break; } foreach (int id in array) { result.Add (mainAnimation[id]); } return result; }