public void _wm_deployBottomPanel() { targetTypeHereTransparency = 1.0f; bottomPanelStatus = BarStatus.appearing; targetBottomY = DeployedBottomY; panelMustNotifyFinishAction = false; }
/// <summary> /// 取消激活 /// </summary> public void InactiveAnimation() { if (this.status == BarStatus.Active) { StartCoroutine(this.inactiveAnimation()); this.status = BarStatus.None; } }
/// <summary> /// 交换动画 /// </summary> public void SwapAnimation() { if (!this.CanChangeTo(BarStatus.Swap)) { return; } StartCoroutine(this.swapAnimation()); this.status = BarStatus.Swap; }
/// <summary> /// 对比动画 /// </summary> public void CompareAnimation() { if (!this.CanChangeTo(BarStatus.Compare)) { return; } StartCoroutine(this.compareAnimation()); this.status = BarStatus.Compare; }
public void _wm_hideBottomPanel() { if ((bottomPanelStatus == BarStatus.showing) || (bottomPanelStatus == BarStatus.appearing)) { bottomPanelStatus = BarStatus.disappearing; targetBottomY = HiddenBottomY; panelMustNotifyFinishAction = false; } }
public void _wm_hideTopBar() { if ((topBarStatus == BarStatus.showing) || (topBarStatus == BarStatus.appearing)) { topBarStatus = BarStatus.disappearing; targetTopY = HiddenTopY; panelMustNotifyFinishAction = false; } }
public void _wm_showBottomPanel() { if ((bottomPanelStatus == BarStatus.hidden) || (bottomPanelStatus == BarStatus.disappearing)) { bottomPanelStatus = BarStatus.appearing; targetBottomY = ShowingBottomY; TypeHereTextRef.color = new Vector4(0.0f, 0.0f, 0.0f, 1.0f); TypeHereRef.color = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); panelMustNotifyFinishAction = false; } }
private void bar_status(BarStatus statusInfo) { switch (statusInfo) { case BarStatus.Narrating: statusBar("Narrating Text...", Color.Transparent, global::WindowsFormsApplication1.Properties.Resources.narrator, global::WindowsFormsApplication1.Properties.Resources.NarratLoadin); return; case BarStatus.Paused: statusBar("Paused. (Resume to Narrate)", Color.Honeydew, global::WindowsFormsApplication1.Properties.Resources.paused_loader_, global::WindowsFormsApplication1.Properties.Resources.paused); return; case BarStatus.Resuming: statusBar("Resuming ...", Color.Transparent, global::WindowsFormsApplication1.Properties.Resources.paused, global::WindowsFormsApplication1.Properties.Resources.ajax_loader); return; case BarStatus.Idle: statusBar("Put some text to narrate.", Color.Transparent, global::WindowsFormsApplication1.Properties.Resources.write_something, global::WindowsFormsApplication1.Properties.Resources.kakatuya48px); return; case BarStatus.Complete: statusBar("Narration Completed.", Color.Transparent, global::WindowsFormsApplication1.Properties.Resources.narration_completed, global::WindowsFormsApplication1.Properties.Resources.narration_completed_2); return; case BarStatus.Stopped: statusBar("Stopprd", Color.Transparent, global::WindowsFormsApplication1.Properties.Resources.err, global::WindowsFormsApplication1.Properties.Resources.stopped); return; case BarStatus.Err_Blank: statusBar("No text to narrate! Put some text.", Color.Pink, global::WindowsFormsApplication1.Properties.Resources.write_something, global::WindowsFormsApplication1.Properties.Resources.redd); return; case BarStatus.Err_Pause: statusBar("No text to reading and nothing to pause!", Color.Pink, global::WindowsFormsApplication1.Properties.Resources.err, global::WindowsFormsApplication1.Properties.Resources.redd); return; } }
// Use this for initialization new void Start() { disabledAnswers = new List <int> (); currentParent = bubbleContainerRef; currentSpeaker = SpeakerPosition.right; // NPC #1 positionChanged = true; topBarStatus = BarStatus.hidden; typeHereTransparency = 0.0f; targetTypeHereTransparency = 0.0f; //leftImageRef.enabled = false; //rightImageRef.enabled = false; setMiniature(null, null, 0); setMiniature(null, null, 1); bottomPanelStatus = BarStatus.hidden; topBarRef.GetComponent <RectTransform> ().transform.localPosition = new Vector3(0, HiddenTopY, 0); bottomPanelRef.GetComponent <RectTransform> ().transform.localPosition = new Vector3(0, HiddenBottomY, 0); //nextBubbleY = 20.0f; nextTextY = 180.0f; verticalScroll = 0.0f; targetScroll = 0.0f; maxScroll = 0.0f; blobColor = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); originalPosition = this.transform.position; answerElements = new List <GameObject> (); sayElements = new List <GameObject> (); elements = sayElements; clear(); masterController = GameObject.Find("MasterController").GetComponent <MasterControllerScript> (); ds = masterController.getStorage(); base.Start(); }
/// <summary> /// /// </summary> /// <returns></returns> private IEnumerator compareAnimation() { Image image = this.gameObject.GetComponent <Image>(); image.color = Color.white; yield return(new WaitForSeconds(0.3f)); if (this.recoverMS <= TimeUtil.nowMS()) { image.color = Color.black; } if (this.status == BarStatus.Compare) { this.status = BarStatus.None; } }
/// <summary> /// 判断当前状态是否可以转变为目标状态 /// </summary> /// <param name="targetStatus">目标状态</param> /// <returns></returns> public bool CanChangeTo(BarStatus targetStatus) { switch (this.status) { case BarStatus.None: return(true); case BarStatus.Compare: return(targetStatus == BarStatus.Swap || targetStatus == BarStatus.Active); case BarStatus.Swap: return(false); case BarStatus.Active: return(true); default: return(false); } }
private IEnumerator swapAnimation() { // 变换恢复的时间 int transTimeoutMS = 300; Image image = this.gameObject.GetComponent <Image>(); this.recoverMS = TimeUtil.nowMS() + transTimeoutMS; image.color = Color.red; yield return(new WaitForSeconds(transTimeoutMS * 0.001f)); while (this.recoverMS > TimeUtil.nowMS()) { yield return(new WaitForFixedUpdate()); } image.color = Color.black; if (this.status == BarStatus.Swap) { this.status = BarStatus.None; image.rectTransform.anchoredPosition = this.swapAnimotionOption.GetTargetVec2(); } }
/// <summary> /// it is used to set property to bar. /// this function is used to set text and color on Status bar. Example : /// status =BarStatus.Error red, /// status =BarStatus.warning Yellow, /// status =BarStatus.sucess Green /// </summary> public void StatusBar(string message, BarStatus status) { switch (status) { case BarStatus.Error: StatusBoder.Background = new SolidColorBrush(Windows.UI.Colors.DarkRed); break; case BarStatus.Sucess: StatusBoder.Background = new SolidColorBrush(Windows.UI.Colors.Green); break; case BarStatus.Warnning: StatusBoder.Background = new SolidColorBrush(Windows.UI.Colors.Yellow); break; case BarStatus.Normal: StatusBoder.Background = new SolidColorBrush(Windows.UI.Color.FromArgb(230, 231, 232, 6)); break; } StatusBar_Text.Text = message; }
/// <summary> /// 激活动画 /// </summary> public void ActiveAnimation() { StartCoroutine(this.activeAnimation()); this.status = BarStatus.Active; }
// Update is called once per frame new void Update() { float conversionFactor = Screen.height / 600.0f; if (verticalScroll < targetScroll) { verticalScroll += SCROLLSPEED; if (verticalScroll > targetScroll) { verticalScroll = targetScroll; } Vector3 pos = new Vector3(originalPosition.x, originalPosition.y + verticalScroll * conversionFactor, originalPosition.z); bubbleContainerRef.transform.position = pos; } if (verticalScroll > targetScroll) { verticalScroll -= SCROLLSPEED; if (verticalScroll < targetScroll) { verticalScroll = targetScroll; } Vector3 pos = new Vector3(originalPosition.x, originalPosition.y + verticalScroll * conversionFactor, originalPosition.z); bubbleContainerRef.transform.position = pos; } Vector3 newPos; if (topY > targetTopY) { topY -= panelYSpeed * Time.deltaTime; if (topY < targetTopY) { topBarStatus = BarStatus.showing; topY = targetTopY; newPos = topBarRef.GetComponent <RectTransform> ().transform.localPosition; newPos.y = topY; topBarRef.GetComponent <RectTransform> ().transform.localPosition = newPos; } else { newPos = topBarRef.GetComponent <RectTransform> ().transform.localPosition; newPos.y = topY; topBarRef.GetComponent <RectTransform> ().transform.localPosition = newPos; } } if (topY < targetTopY) { topY += panelYSpeed * Time.deltaTime; if (topY > targetTopY) { topBarStatus = BarStatus.hidden; topY = targetTopY; } newPos = topBarRef.GetComponent <RectTransform> ().transform.localPosition; newPos.y = topY; topBarRef.GetComponent <RectTransform> ().transform.localPosition = newPos; } if (bottomY > targetBottomY) { bottomY -= panelYSpeed * Time.deltaTime; if (bottomY < targetBottomY) { bottomPanelStatus = BarStatus.hidden; bottomY = targetBottomY; newPos = bottomPanelRef.GetComponent <RectTransform> ().transform.localPosition; newPos.y = bottomY; bottomPanelRef.GetComponent <RectTransform> ().transform.localPosition = newPos; if (panelMustNotifyFinishAction) { notifyFinishAction(); } clearAnswers(); } else { newPos = bottomPanelRef.GetComponent <RectTransform> ().transform.localPosition; newPos.y = bottomY; bottomPanelRef.GetComponent <RectTransform> ().transform.localPosition = newPos; } } if (bottomY < targetBottomY) { bottomY += panelYSpeed * Time.deltaTime; if (bottomY > targetBottomY) { bottomPanelStatus = BarStatus.showing; bottomY = targetBottomY; newPos = bottomPanelRef.GetComponent <RectTransform> ().transform.localPosition; newPos.y = bottomY; bottomPanelRef.GetComponent <RectTransform> ().transform.localPosition = newPos; } else { newPos = bottomPanelRef.GetComponent <RectTransform> ().transform.localPosition; newPos.y = bottomY; bottomPanelRef.GetComponent <RectTransform> ().transform.localPosition = newPos; } } if (typeHereTransparency > targetTypeHereTransparency) { typeHereTransparency -= (panelYSpeed / 100.0f) * Time.deltaTime; if (typeHereTransparency < targetTypeHereTransparency) { typeHereTransparency = targetTypeHereTransparency; } Color col = new Vector4(1.0f, 1.0f, 1.0f, 1.0f - typeHereTransparency); TypeHereRef.color = col; TypeHereTextRef.color = col; } if (typeHereTransparency < targetTypeHereTransparency) { typeHereTransparency += (panelYSpeed / 100.0f) * Time.deltaTime; if (typeHereTransparency > targetTypeHereTransparency) { typeHereTransparency = targetTypeHereTransparency; } Color col = new Vector4(1.0f, 1.0f, 1.0f, 1.0f - typeHereTransparency); TypeHereRef.color = col; TypeHereTextRef.color = col; } }