public void Activate(SelectionRegion region, bool isHover) { if (inOutState == InOutState.Outro) { return; } GetComponent <CursorOpener>().enabled = false; onAnyActivate?.Invoke(this, isHover); switch (region) { case SelectionRegion.InnerDeadZone: inOutState = InOutState.Outro; onInnerDeadZoneActivate?.Invoke(this, isHover); break; case SelectionRegion.OuterDeadZone: inOutState = InOutState.Outro; onOuterDeadZoneActivate?.Invoke(this, isHover); break; case SelectionRegion.Button: if (selectedButton < 0 || selectedButton > buttons.Count) { RadialPingsPlugin.logger.LogError("ProceduralRadialMenu was activated with a bad button index selected, possible layout failure"); inOutState = InOutState.Outro; return; } if (buttons[selectedButton].closeOnActivate) { inOutState = InOutState.Outro; } buttons[selectedButton].Activate(this, isHover); break; } }
public CustomAsyncOperation Out() { // finished = false; CustomAsyncOperation operation = outAnimator.StartAnimation(max, min); state = InOutState.OutAnim; operation.OnComplete += (op) => state = InOutState.Minimum; return(operation); }
// private void finishIn () { // state = InOutState.Maximum; // finished = true; // if (onInFinish != null) onInFinish (); // } // private void finishOut () { // state = InOutState.Minimum; // finished = true; // if (onOutFinish != null) onOutFinish (); // } public CustomAsyncOperation In() { // finished = false; CustomAsyncOperation operation = inAnimator.StartAnimation(min, max); state = InOutState.InAnim; operation.OnComplete += (op) => state = InOutState.Maximum; return(operation); }
void OnEnable() { myRect = GetComponent <RectTransform>(); mainCaption = transform.Find("DisplayContainer").Find("Caption").GetComponent <TextMeshPro>(); contextCaption = transform.Find("DisplayContainer").Find("ContextCaption").GetComponent <TextMeshPro>(); inOutState = InOutState.Intro; inOutTimer = 0f; displayOnlyThetaOffsetDegr = inOutTwistAngleDegr; }
public IInOutState Get(string id) { IInOutState state = CurrentSession.Get <InOutState> (id); if (state == null) { state = new InOutState(); (state as InOutState).DocumentNumber = id; } return(state); }
public static IEnumerable <IInOutState> ToInOutStateCollection(IEnumerable <string> ids) { var states = new List <InOutState>(); foreach (var id in ids) { var s = new InOutState(); s.DocumentNumber = id; states.Add(s); } return(states); }
public IInOutState Get(string id, bool nullAllowed) { IInOutState state = CurrentSession.Get <InOutState> (id); if (!nullAllowed && state == null) { state = new InOutState(); (state as InOutState).DocumentNumber = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IInOutState>(state, new Type[] { typeof(ISaveable) }, _readOnlyPropertyNames)); } return(state); }
public void SetData(byte[] tBuff) { TagData = new ActiveTagData_V17(); int num = TagData.SetData(tBuff); if (tBuff.Length >= num + 1) { RSSI = tBuff[num]; num++; } if (tBuff.Length >= num + 8) { byte[] array = new byte[8]; Array.Copy(tBuff, num, array, 0, 8); UTC = Common.setUtcTime(array); num += 8; } if (tBuff.Length >= num + 1) { peopleInOutState = (InOutState)tBuff[num]; num++; } }
private void AnimateToState(InOutState newState) { state = newState; isAnimating = true; startTime = Time.time; }
void UpdateDisplay() { float targetAlpha = 1f; float targetScale = 1f; if (inOutState == InOutState.Intro) { inOutTimer += Time.unscaledDeltaTime; float timerAmt = inOutTimer / inOutAnimSpeed; displayOnlyThetaOffsetDegr = (1f - timerAmt) * inOutTwistAngleDegr; targetScale = timerAmt; targetAlpha = timerAmt; if (inOutTimer >= inOutAnimSpeed) { displayOnlyThetaOffsetDegr = 0f; inOutState = InOutState.Active; inOutTimer = 0; } } else if (inOutState == InOutState.Outro) { inOutTimer += Time.unscaledDeltaTime; float timerAmt = inOutTimer / inOutAnimSpeed; displayOnlyThetaOffsetDegr = timerAmt * -inOutTwistAngleDegr; targetScale = timerAmt * extraOutroScale + 1f; targetAlpha = 1f - timerAmt; if (inOutTimer >= inOutAnimSpeed) { GameObject.Destroy(gameObject); } } visualScale = Mathf.SmoothDamp(visualScale, targetScale, ref scaleVel, 0.125f, 100f, Time.unscaledDeltaTime); visualAlpha = Mathf.SmoothDamp(visualAlpha, targetAlpha, ref alphaVel, 0.125f, 100f, Time.unscaledDeltaTime); transform.Find("DisplayContainer").localScale = new Vector3(visualScale, visualScale, 1f); var buttonThetaDegr = 360f / buttons.Count; for (int i = 0; i < buttons.Count; i++) { buttons[i].targetAlphaMul = targetAlpha; buttons[i].targetRotDegr = displayOnlyThetaOffsetDegr; buttons[i].directRotDegr = thetaOffsetDegr + i * buttonThetaDegr; buttons[i].targetScale = buttons[i].hoverActive ? hoverScale : 1f; } string mainCaptionToken = "INDEX ERROR!"; ProceduralRadialButton.ContextStringProvider contextProvider = null; switch (selectedRegion) { case SelectionRegion.InnerDeadZone: mainCaptionToken = innerDeadZoneToken; contextProvider = innerDeadZoneContext; break; case SelectionRegion.OuterDeadZone: mainCaptionToken = outerDeadZoneToken; contextProvider = outerDeadZoneContext; break; case SelectionRegion.Button: if (selectedButton == -1) { break; } mainCaptionToken = buttons[selectedButton].descriptionToken; contextProvider = buttons[selectedButton].contextStringProvider; break; } mainCaption.text = Language.GetString(mainCaptionToken); contextCaption.text = contextProvider?.Invoke(this) ?? ""; mainCaption.color = new Color(1f, 1f, 1f, visualAlpha); contextCaption.color = new Color(1f, 1f, 1f, visualAlpha); }