/**********************************************************************/ #endregion protected override void Awake(){ base.Awake(); if( m_Tweener == null ){ m_Tweener = GetComponent<UIPlayTween>(); if( m_Tweener == null ){ Debug.LogWarning("Error! No tweener present! " + gameObject.name + " " + gameObject.transform.position); } } m_FSM = new StateMachine<Behaviour_DoorSimple>(this, m_Locked); m_FSM.addState(m_Opened); m_FSM.addState(m_Closed); switch( m_CurrentState ){ case CurrentState.Locked: m_FSM.changeState<SimpleDoorLockedState>(); break; case CurrentState.Closed: m_FSM.changeState<SimpleDoorClosedState>(); break; case CurrentState.Open: m_FSM.changeState<SimpleDoorOpenedState>(); break; } m_Callbacks[0] = new HbClips.animationCallback (beginCallback); m_Callbacks[1] = new HbClips.animationCallback (activateCallback); //Assign the callback func m_Callbacks[2] = new HbClips.animationCallback (endCallback); }
static GameObject NoBtn;//否定按钮 public static void Init(Transform ui) { UI = ui; Tween = UI.GetComponent<UIPlayTween>(); PromptLab = UI.Find("PromptBg/Prompt").GetComponent<UILabel>(); OkBtn = UI.Find("PromptBg/Ok").gameObject; YesBtn = UI.Find("PromptBg/Yes").gameObject; NoBtn = UI.Find("PromptBg/No").gameObject; }
void Awake(){ m_ScrollView = GetComponentInChildren<UIScrollView>(); m_TextLabel = GetComponentInChildren<UILabel>(); if( m_TextLabel == null ){ Debug.LogError("Error. No NoteLabel found!"); Debug.Break(); } UIDragScrollView view; m_Tweener = gameObject.GetComponent<UIPlayTween>(); }
public UIControllerExp(Transform ui) { InitBase(); UIC = this; Main = ui.Find("Main").GetComponent<UIPlayTween>(); Shop = ui.Find("Shop").GetComponent<UIPlayTween>(); Task = ui.Find("Task").GetComponent<UIPlayTween>(); Tweens.Add(Main); Tweens.Add(Shop); Tweens.Add(Task); }
static int get_disableWhenFinished(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); UIPlayTween obj = (UIPlayTween)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name disableWhenFinished"); } else { LuaDLL.luaL_error(L, "attempt to index disableWhenFinished on a nil value"); } } LuaScriptMgr.Push(L, obj.disableWhenFinished); return(1); }
static int set_onFinished(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); UIPlayTween obj = (UIPlayTween)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name onFinished"); } else { LuaDLL.luaL_error(L, "attempt to index onFinished on a nil value"); } } obj.onFinished = (List <EventDelegate>)LuaScriptMgr.GetNetObject(L, 3, typeof(List <EventDelegate>)); return(0); }
static int set_playDirection(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); UIPlayTween obj = (UIPlayTween)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name playDirection"); } else { LuaDLL.luaL_error(L, "attempt to index playDirection on a nil value"); } } obj.playDirection = (AnimationOrTween.Direction)LuaScriptMgr.GetNetObject(L, 3, typeof(AnimationOrTween.Direction)); return(0); }
static int set_tweenTarget(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); UIPlayTween obj = (UIPlayTween)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name tweenTarget"); } else { LuaDLL.luaL_error(L, "attempt to index tweenTarget on a nil value"); } } obj.tweenTarget = (GameObject)LuaScriptMgr.GetUnityObject(L, 3, typeof(GameObject)); return(0); }
static int set_resetIfDisabled(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); UIPlayTween obj = (UIPlayTween)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name resetIfDisabled"); } else { LuaDLL.luaL_error(L, "attempt to index resetIfDisabled on a nil value"); } } obj.resetIfDisabled = LuaScriptMgr.GetBoolean(L, 3); return(0); }
static int set_includeChildren(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); UIPlayTween obj = (UIPlayTween)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name includeChildren"); } else { LuaDLL.luaL_error(L, "attempt to index includeChildren on a nil value"); } } obj.includeChildren = LuaScriptMgr.GetBoolean(L, 3); return(0); }
static int set_disableWhenFinished(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); UIPlayTween obj = (UIPlayTween)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name disableWhenFinished"); } else { LuaDLL.luaL_error(L, "attempt to index disableWhenFinished on a nil value"); } } obj.disableWhenFinished = (AnimationOrTween.DisableCondition)LuaScriptMgr.GetNetObject(L, 3, typeof(AnimationOrTween.DisableCondition)); return(0); }
public override void OnInspectorGUI() { NGUIEditorTools.SetLabelWidth(120f); UIPlayTween tw = target as UIPlayTween; GUILayout.Space(6f); GUI.changed = false; GameObject tt = (GameObject)EditorGUILayout.ObjectField("Tween Target", tw.tweenTarget, typeof(GameObject), true); bool inc = EditorGUILayout.Toggle("Include Children", tw.includeChildren); int group = EditorGUILayout.IntField("Tween Group", tw.tweenGroup, GUILayout.Width(160f)); AnimationOrTween.Trigger trigger = (AnimationOrTween.Trigger)EditorGUILayout.EnumPopup("Trigger condition", tw.trigger); AnimationOrTween.Direction dir = (AnimationOrTween.Direction)EditorGUILayout.EnumPopup("Play direction", tw.playDirection); AnimationOrTween.EnableCondition enab = (AnimationOrTween.EnableCondition)EditorGUILayout.EnumPopup("If target is disabled", tw.ifDisabledOnPlay); ResetOnPlay rs = tw.resetOnPlay ? ResetOnPlay.RestartTween : (tw.resetIfDisabled ? ResetOnPlay.RestartIfNotPlaying : ResetOnPlay.ContinueFromCurrent); ResetOnPlay reset = (ResetOnPlay)EditorGUILayout.EnumPopup("On activation", rs); AnimationOrTween.DisableCondition dis = (AnimationOrTween.DisableCondition)EditorGUILayout.EnumPopup("When finished", tw.disableWhenFinished); if (GUI.changed) { NGUIEditorTools.RegisterUndo("Tween Change", tw); tw.tweenTarget = tt; tw.tweenGroup = group; tw.includeChildren = inc; tw.trigger = trigger; tw.playDirection = dir; tw.ifDisabledOnPlay = enab; tw.resetOnPlay = (reset == ResetOnPlay.RestartTween); tw.resetIfDisabled = (reset == ResetOnPlay.RestartIfNotPlaying); tw.disableWhenFinished = dis; NGUITools.SetDirty(tw); } NGUIEditorTools.SetLabelWidth(80f); NGUIEditorTools.DrawEvents("On Finished", tw, tw.onFinished); }
static int get_tweenGroup(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); UIPlayTween obj = (UIPlayTween)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name tweenGroup"); } else { LuaDLL.luaL_error(L, "attempt to index tweenGroup on a nil value"); } } LuaScriptMgr.Push(L, obj.tweenGroup); return(1); }
private IEnumerator AnimationTweenSkillDetail(float posX) { if (skillManager.gameObject.activeInHierarchy) { CloseSkillWindow(); yield return(new WaitForSeconds(0.5f)); } TweenPosition tweenPos = skillManager.GetComponent <TweenPosition>(); tweenPos.from = new Vector3(posX, 0, 0); tweenPos.to = new Vector3(posX, 226.3f, 0); UIPlayTween playTween = new UIPlayTween(); playTween.tweenTarget = skillManager.gameObject; playTween.playDirection = AnimationOrTween.Direction.Forward; playTween.ifDisabledOnPlay = AnimationOrTween.EnableCondition.EnableThenPlay; playTween.disableWhenFinished = AnimationOrTween.DisableCondition.DisableAfterReverse; playTween.Play(true); yield return(null); }
public void OnButtonMarket_Click() { if (GameManager.tutorial.step < TutorialManager.TutorialStep.Finished) { uiTutorial.arrowShop.SetActive(false); if (GameManager.tutorial.step >= TutorialManager.TutorialStep.BuyHero_Exit) { return; } } HideAllSubButton(); //uiTutorial.btnMarket.transform.FindChild("Label").gameObject.SetActive(false); UIPlayTween tween = uiTutorial.btnMarket.GetComponent <UIPlayTween>(); tween.tweenTarget = uiTutorial.btnMarket_Hero.gameObject; tween.Play(true); tween.tweenTarget = uiTutorial.btnMarket_Shop.gameObject; tween.Play(true); tween.tweenTarget = uiTutorial.btnMarket_Inventory.gameObject; tween.Play(true); }
public static void PlayGroupTween(GameObject go, int tweenGroup, bool isForward, LuaFunction luafunc) { if (go == null) { return; } UIPlayTween component = go.GetComponent <UIPlayTween>(); if (component != null) { component.tweenGroup = tweenGroup; if (luafunc != null) { component.SetOnFinished(delegate { luafunc.Call(); luafunc.Dispose(); luafunc = null; }); } component.Play(isForward); } }
private void InitCom() { DrawMapLine(); //初始化已有的UI littleStarTrans = transform.Find("LittleStar"); tweenPos = littleStarTrans.GetComponent <TweenPosition>(); playTween = littleStarTrans.GetComponent <UIPlayTween>(); EventDelegate.Add(playTween.onFinished, OnTweenPosFinished); bigStarTrans = transform.Find("BigStar"); directionBtnFrame = transform.Find("DirectionBtnFrame"); UIButton directionBtn; for (int i = 0; i < 4; i++) { if (i == 0) { directionBtns[i] = directionBtnFrame.Find("UpBtn"); } else if (i == 1) { directionBtns[i] = directionBtnFrame.Find("DownBtn"); } else if (i == 2) { directionBtns[i] = directionBtnFrame.Find("LeftBtn"); } else if (i == 3) { directionBtns[i] = directionBtnFrame.Find("RightBtn"); } directionBtn = directionBtns[i].GetComponent <UIButton>(); EventDelegate.Add(directionBtn.onClick, OnBtnClick); } }
public void AddUIPlayTweenEvent(GameObject go, LuaFunction luafunc) { if (go == null || luafunc == null) { return; } UIPlayTween playTween = go.GetComponent <UIPlayTween>(); if (playTween == null) { return; } if (!this.playTweens.ContainsKey(playTween)) { this.playTweens.Add(playTween, luafunc); } EventDelegate.Add(playTween.onFinished, delegate { luafunc.Call(new object[] { playTween }); }); }
private void OnPushedCloseButton() { UIPlayTween component = this.windowLocator.GetComponent <UIPlayTween>(); EventDelegate.Set(component.onFinished, new EventDelegate.Callback(this.OnFinishedCloseTween)); if (this.actionCloseButtonClick != null) { this.actionCloseButtonClick(); } this.StartWindowAnimation(false, TutorialImageWindow.WindowMoveType.ACTIVE); this.pageMark.StartInvisible(); this.pageArrow.StartInvisible(); BoxCollider component2 = this.closeButton.GetComponent <BoxCollider>(); component2.enabled = false; this.swipeCont.SetActionSwipe(null, null); this.isEnableBackButton = false; this.pageButton.gameObject.SetActive(false); TweenAlpha component3 = this.closeButton.GetComponent <TweenAlpha>(); component3.from = 1f; component3.to = 0f; component3.PlayForward(); }
public override void OnLoadedUI(bool close3dTouch, object args) { base.OnLoadedUI(close3dTouch, args); _closeButton = transform.Find("chat_forward/botton_close").gameObject; _toggleSound = transform.Find("chat_forward/sound_swith").GetComponent<UIToggle>(); _chatTemplate = transform.Find("chat_forward/chat_scroll/chat_template").gameObject; _tableChatPanel = transform.Find("chat_forward/chat_scroll/Table").GetComponent<UITable>(); _chatScrollView = transform.Find("chat_forward/chat_scroll").GetComponent<UIScrollView>(); _chatPanel = transform.Find("chat_forward/chat_scroll").GetComponent<UIPanel>(); _gridChanel = transform.Find("chat_forward/grid_chanel").GetComponent<UIGrid>(); _chanelTemplate = transform.Find("chat_forward/chanel_button_template").gameObject; _sendButton = transform.Find("chat_forward/send_group/botton_send").gameObject; _recordButton = transform.Find("chat_forward/send_group/botton_v").gameObject; _inputBox = transform.Find("chat_forward/send_group").GetComponent<UIInput>(); _playTweeen = transform.Find("chat_forward/send_group/botton_menu").GetComponent<UIPlayTween>(); _popMenu = transform.Find("Panel/Pop"); _lockMessage = transform.Find("Panel/Message").gameObject; _labelLock = transform.Find("Panel/Message/Label").GetComponent<UILabel>(); chatDataList = ChatDataManager.GetInstance().chatDataList; _tablePosition = _tableChatPanel.transform.localPosition; _scrollPosition = _chatScrollView.transform.localPosition; _panelOffset = _chatPanel.clipOffset; needIgnoreList = new List<Transform> { _popMenu, _playTweeen.transform }; _chatInfoItems = new TableItemList<ChatDetailItem>(null, this); chatType = enumChatType.CHANEL_CURRENT; HideLockMessage(); _popMenu.gameObject.SetActive(false); _chanelTemplate.SetActive(false); _chatTemplate.SetActive(false); EventDelegate.Add(_inputBox.onChange, InputTextChange); EventDelegate.Add(_toggleSound.onChange, () => { _isAutoAudioList[(int)chatType] = _toggleSound.value; }); _chatScrollView.onMomentumMove = () => { if (CheckChatPanelBottom() && _lockMessgeNum > 0) { RefreshChangeTap(); } }; _gridChanel.CreateScrollView(_chanelTemplate, GameConst.ChanelList, FillChanelItem); RegistUIBase<ChatUIPopMenu>(_popMenu); RegistUIButton(_closeButton, CloseClick); RegistUIButton(_sendButton, SendClick); RegistUIButton(_recordButton, RecordClick); RegistUIButton(_lockMessage, LockClick); }
//显示UI public static void Show(UIPlayTween ui) { ui.playDirection = AnimationOrTween.Direction.Forward; ui.Play(true); }
private void InitCom() { int count = MainData.Instance.gameDatas.Count; if (count <= 0) { Debug.LogError("没有游戏数据"); return; } checkpoint = MainData.Instance.CurCheckpoint - 1; checkpoint = Mathf.Max(0, Mathf.Min(checkpoint, count)); gameData = MainData.Instance.gameDatas[checkpoint]; if (gameData == null) { Debug.LogError("该关卡的游戏数据为空"); return; } bgm = transform.GetComponent <AudioSource>(); //if(MainData.Instance.IsPlayMusic) // NGUITools.PlaySound(audioList[0], volume, pitch); PlayBGM(MainData.Instance.IsPlayMusic); gameMap = new int[gameData.col, gameData.row]; count = gameData.obstacleList.Count; for (int i = 0; i < count; i++) { gameMap[(int)gameData.obstacleList[i].x, (int)gameData.obstacleList[i].y] = 1; } count = gameData.transferList.Count; for (int i = 0; i < count; i++) { gameMap[(int)gameData.transferList[i].from.x, (int)gameData.transferList[i].from.y] = 2; gameMap[(int)gameData.transferList[i].to.x, (int)gameData.transferList[i].to.y] = 3; } gameMap[(int)gameData.bigStarPos.x, (int)gameData.bigStarPos.y] = 4; DrawMapLine(); //初始化已有的UI littleStarTrans = transform.Find("LittleStar"); tweenPos = littleStarTrans.GetComponent <TweenPosition>(); playTween = littleStarTrans.GetComponent <UIPlayTween>(); EventDelegate.Add(playTween.onFinished, OnTweenPosFinished); bigStarTrans = transform.Find("BigStar"); directionBtnFrame = transform.Find("DirectionBtnFrame"); UIButton directionBtn; for (int i = 0; i < 4; i++) { if (i == 0) { directionBtns[i] = directionBtnFrame.Find("UpBtn"); } else if (i == 1) { directionBtns[i] = directionBtnFrame.Find("DownBtn"); } else if (i == 2) { directionBtns[i] = directionBtnFrame.Find("LeftBtn"); } else if (i == 3) { directionBtns[i] = directionBtnFrame.Find("RightBtn"); } directionBtn = directionBtns[i].GetComponent <UIButton>(); EventDelegate.Add(directionBtn.onClick, OnBtnClick); } }
/// <summary> /// Callback triggered when each tween executed by this script finishes. /// </summary> void OnFinished () { if (--mActive == 0 && current == null) { current = this; EventDelegate.Execute(onFinished); // Legacy functionality if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished)) eventReceiver.SendMessage(callWhenFinished, SendMessageOptions.DontRequireReceiver); eventReceiver = null; current = null; } }
void Start() { TweenPlay= ButtonF.GetComponent<UIPlayTween>(); TweenPlay.playDirection = AnimationOrTween.Direction.Forward; UIEventListener.Get(ButtonF).onClick = TweenF; }
public void StartDisplay() { UIPlayTween component = base.GetComponent <UIPlayTween>(); component.Play(true); }
//隐藏层级UI public void Hide(UIPlayTween Tween) { for (int i = 0, len = Layers.Count; i < len; i++) { if (Layers[i] == Tween) { UIController.Hide(Tween); States[i] = LayerState.Close; int index = i + 1; if (index < len && States[index] == LayerState.Wait) { States[index] = LayerState.Open; UIController.Show(Layers[index]); } break; } } }
//动画回调 protected static void AnimationCallBack(UIPlayTween Tween, EventDelegate.Callback callback) { if (callback != null) { List<EventDelegate> callbacks = new List<EventDelegate>(); callbacks.Add(new EventDelegate(callback)); Tween.onFinished = callbacks; } UIController.Show(Tween); }
//--------------------------------------------------------------------- private bool PlayWindowAnimation(RequestType nextRequest, bool isShow) { RequestBatch batch = LastRequestBatch(); if (batch != null) { // Only one animation playing. if (batch.type == RequestType.ShowAnimation || batch.type == RequestType.HideAnimation) { return(false); } } RequestType requestType = isShow ? RequestType.ShowAnimation : RequestType.HideAnimation; int totalAnimationCount = 0; AnimationOrTween.Trigger conditionTrigger = isShow ? AnimationOrTween.Trigger.OnActivateTrue : AnimationOrTween.Trigger.OnActivateFalse; for (int index = 0; index < m_WindowAnimations.Length; ++index) { UIPlayTween playTween = m_WindowAnimations[index]; if (playTween.trigger != conditionTrigger || !playTween.enabled || !playTween.gameObject.activeSelf || playTween.tweenTarget == null) { continue; } UITweener[] childTweens = null; if (playTween.includeChildren) { childTweens = playTween.tweenTarget.GetComponentsInChildren <UITweener>(); } else { childTweens = playTween.tweenTarget.GetComponents <UITweener>(); } int ownTweenerCount = 0; for (int i = 0; i < childTweens.Length; ++i) { if (childTweens[i].tweenGroup == playTween.tweenGroup) { ownTweenerCount++; } } if (ownTweenerCount == 0) { continue; } ++totalAnimationCount; EventDelegate finishedCallback = null; object[] lastDataArray = null; if (requestDataArray != null && requestDataArray.Length != 0) { lastDataArray = new object[requestDataArray.Length]; Array.Copy(requestDataArray, lastDataArray, lastDataArray.Length); } finishedCallback = new EventDelegate(delegate() { playTween.onFinished.Remove(finishedCallback); --totalAnimationCount; if (totalAnimationCount <= 0) { RemoveRequestBatch(requestType); PushRequest(nextRequest, lastDataArray); } }); playTween.onFinished.Add(finishedCallback); } if (totalAnimationCount == 0) { return(false); } PushRequest(requestType, requestDataArray); // iTween toggle message gameObject.SendMessage("OnActivate", isShow, SendMessageOptions.DontRequireReceiver); return(true); }
//显示层级UI public void Show(UIPlayTween Tween) { Layers.Add(Tween); int count = States.Count; if (count == 0) { States.Add(LayerState.Open); UIController.Show(Tween); } else { LayerState last = States[count - 1]; if (last == LayerState.Close) { States.Add(LayerState.Open); UIController.Show(Tween); } else { States.Add(LayerState.Wait); } } }
//显示层级UI public static void ShowLayer(UIPlayTween ui) { Layer.Show(ui); }
public static void Hide(UIPlayTween[] uis) { for (int i = 0, len = uis.Length; i < len; i++) Hide(uis[i]); }
//隐藏UI public static void Hide(UIPlayTween ui) { ui.playDirection = AnimationOrTween.Direction.Reverse; ui.Play(true); }
private void OnFinished() { if (--this.mActive == 0 && UIPlayTween.current == null) { UIPlayTween.current = this; EventDelegate.Execute(this.onFinished); if (this.eventReceiver != null && !string.IsNullOrEmpty(this.callWhenFinished)) { this.eventReceiver.SendMessage(this.callWhenFinished, SendMessageOptions.DontRequireReceiver); } this.eventReceiver = null; UIPlayTween.current = null; } }
//显示布局 protected void ShowUI(UIPlayTween[] uis, UIPlayTween[] uis_ignore) { for (int i = 0; i < Tweens.Count; i++) { UIPlayTween ui = Tweens[i]; bool isIgnore = false;//忽略 if (uis_ignore != null) for (int j = 0, len = uis_ignore.Length; j < len; j++) { isIgnore = ui == uis_ignore[j]; if (isIgnore) break; } if (!isIgnore) { bool isShow = false; for (int j = 0; j < uis.Length; j++) { isShow = ui == uis[j]; if (isShow) break; } //显示\隐藏UI if (isShow) Show(ui); else if (!isShow) Hide(ui); } } }
public void StartInvisible() { UIPlayTween component = base.GetComponent <UIPlayTween>(); component.Play(false); }
private UXCheckbox CreateCheckbox(GameObject gameObject, UIToggle nguiCheckbox, UIButton nguiButton, UIPlayTween nguiTween) { UXCheckboxComponent uXCheckboxComponent = gameObject.GetComponent <UXCheckboxComponent>(); if (uXCheckboxComponent != null) { uXCheckboxComponent.Checkbox = null; UnityEngine.Object.Destroy(uXCheckboxComponent); } uXCheckboxComponent = gameObject.AddComponent <UXCheckboxComponent>(); uXCheckboxComponent.NGUICheckbox = nguiCheckbox; uXCheckboxComponent.NGUIButton = nguiButton; uXCheckboxComponent.NGUITween = nguiTween; UXCheckbox uXCheckbox = new UXCheckbox(this.uxCamera, uXCheckboxComponent); uXCheckboxComponent.Checkbox = uXCheckbox; uXCheckbox.Selected = uXCheckboxComponent.Selected; uXCheckbox.RadioGroup = uXCheckboxComponent.RadioGroup; this.AddElement(gameObject.name, uXCheckbox); return(uXCheckbox); }
public void SetGameItem(ShopItem item, UIShopManager manager) { uiShopManager = manager; shopItem = item; goldPrice = shopItem.PriceGold; silverPrice = shopItem.PriceSilver; lblName.text = GameManager.localization.getItem(item.ItemId).Name; _playTween = btnInformation.GetComponent <UIPlayTween>(); _playTween.tweenTarget = uiShopManager.uiItemReview.gameObject; btnInformation.gameObject.SetActive(true); IconOfItem.mainTexture = Helper.LoadTextureForSupportItem(item.ItemId); IconOfItem.SetDimensions(120, 120); if (item.UserLevel > 0) { lblLevel.text = string.Format(GameManager.localization.GetText("Shop_MinLevel"), item.UserLevel, item.UserLevel + 4); } _disable = false; if (manager.activeTab == UIShopManager.ActiveTab.IOSReCharge) { itemPriceRoot.SetActive(false); vaultRoot.SetActive(true); float VNDPrice = 0; if (Global.language == Global.Language.VIETNAM) { VNDPrice = item.PriceVND; } else { VNDPrice = item.PriceUSD; } if (item.PriceGoldSale > 0) { lblVaultGold.text = string.Format(GameManager.localization.GetText("Shop_GoldFormat"), item.PriceGoldSale); } else if (item.PriceSilverSale > 0) { lblVaultGold.text = string.Format(GameManager.localization.GetText("Shop_SilverFormat"), item.PriceSilverSale); } lblVaultVND.text = string.Format(GameManager.localization.GetText("Shop_VNDFormat"), VNDPrice); if (item.Promotion > 0) { bonusRoot.SetActive(true); lblBonus.text = string.Format(GameManager.localization.GetText("Shop_GoldFormat"), item.Promotion); } } else { itemPriceRoot.SetActive(true); vaultRoot.SetActive(false); } }
protected UXElement CreateElements(GameObject parent) { UIButton component = parent.GetComponent <UIButton>(); UIToggle component2 = parent.GetComponent <UIToggle>(); UIGrid component3 = parent.GetComponent <UIGrid>(); UITable component4 = parent.GetComponent <UITable>(); UISprite component5 = parent.GetComponent <UISprite>(); UILabel component6 = parent.GetComponent <UILabel>(); UIInput component7 = parent.GetComponent <UIInput>(); UISlider component8 = parent.GetComponent <UISlider>(); UITexture component9 = parent.GetComponent <UITexture>(); UIPlayTween component10 = parent.GetComponent <UIPlayTween>(); MeshRenderer component11 = parent.GetComponent <MeshRenderer>(); UXElement result; if (component8 != null) { result = this.CreateSlider(parent, component8); } else if (component7 != null) { result = this.CreateInput(parent, component7); } else if (component6 != null) { result = this.CreateLabel(parent, component6); } else if (component3 != null) { result = this.CreateGrid(parent, component3); } else if (component4 != null) { result = this.CreateTable(parent, component4); } else if (component5 != null) { result = this.CreateSprite(parent, component5); } else if (component2 != null) { result = this.CreateCheckbox(parent, component2, component, component10); } else if (component != null) { result = this.CreateButton(parent, component); } else if (component9 != null) { result = this.CreateTexture(parent, component9); } else if (component11 != null) { result = this.CreateMeshRenderer(parent, component11); } else { result = this.CreateElement(parent); } int i = 0; int childCount = parent.transform.childCount; while (i < childCount) { this.CreateElements(parent.transform.GetChild(i).gameObject); i++; } return(result); }
private void Awake() { type = ShowType.Normal; confirmButton.onClick.Add(new EventDelegate(this, "OnButtonClick")); tweener = GetComponent <UIPlayTween>(); }
void Awake() { m_Tweener = GetComponent<UIPlayTween> (); }
void OnPlayTweenFinishHandle(UIPlayTween playTween) { if (CallLuaBegin(playTween.gameObject, "onPlayTweenFinish") == true) { CallLuaEnd(0); } }
void Start() { item.SetActive(false); SwitchBtnSprite(false); teamObj.SetActive(false); tasksObj.SetActive(true); //questitem.SetActive(false); PlayTween = RightButton.GetComponent <UIPlayTween>(); UIManager.SetButtonEventHandler(TaskButton.gameObject, EnumButtonEvent.OnClick, OnClickPTaskBtn, 0, 0); UIManager.SetButtonEventHandler(TeamButton.gameObject, EnumButtonEvent.OnClick, OnClickPTeamButton, 0, 0); UIManager.SetButtonEventHandler(RightButton.gameObject, EnumButtonEvent.OnClick, OnRightButtonDown, 0, 0); //QuestSystem.OnQuestUpdate += OnQuestUpdateOk; if (QuestSystem.CurrentList.Count == 0) { PlayerPrefs.SetInt("xysk_miniQuest_open", 0); } else { PlayerPrefs.SetInt("xysk_miniQuest_open", 1); } IsOpen = PlayerPrefs.GetInt("xysk_miniQuest_open") == 1; if (IsOpen) { PlayTween.Play(IsOpen); } if (IsOpen) { //raSp.transform.rotation = new Quaternion(raSp.transform.rotation.x,180,raSp.transform.rotation.z,raSp.transform.rotation.w); TweenRotation rot = raSp.GetComponent <TweenRotation>(); rot.from = new Vector3(0, 0, 0); rot.to = new Vector3(0, 180, 0); } else { TweenRotation rot = raSp.GetComponent <TweenRotation>(); rot.from = new Vector3(0, 180, 0); rot.to = new Vector3(0, 0, 0); } GuideManager.Instance.RegistGuideAim(TeamButton.gameObject, GuideAimType.GAT_MainTeamBtn); GuideManager.Instance.RegistGuideAim(TaskButton.gameObject, GuideAimType.GAT_MainTaskBtn); questitem.SetActive(false); //GuideManager.Instance.RegistGuideAim(questitem.transform.parent.gameObject, GuideAimType.GAT_QuestMiniFirst); // GuideManager.Instance.RegistGuideAim(questItems[1].transform.parent.gameObject, GuideAimType.GAT_QuestMiniSecond); // GuideManager.Instance.RegistGuideAim(questItems[2].transform.parent.gameObject, GuideAimType.GAT_QuestMiniThird); if (TeamSystem.IsInTeam()) { if (grid == null) { return; } foreach (Transform tr in grid.transform) { Destroy(tr.gameObject); } // teamPanle.clipOffset = Vector2.zero; // teamPanle.transform.localPosition = Vector3.zero; // teamPanle.GetComponent<UIScrollView>().ResetPosition(); // teamPanle.GetComponent<UIPanel>().clipOffset = Vector2.zero; // teamPanle.transform.localPosition = Vector3.zero; AddTeamItem(TeamSystem.GetTeamMembers()); creataTeamBtn.gameObject.SetActive(false); } else { creataTeamBtn.gameObject.SetActive(true); UIManager.SetButtonEventHandler(creataTeamBtn.gameObject, EnumButtonEvent.OnClick, OnClickcreataTeamBtn, 0, 0); } TeamSystem.OnUpdateMainteamList += UpdateMainteamList; QuestSystem.OnQuestEffectFinish += TaskLabe; TeamSystem.OnTeamDirtyProps += updatePros; if (QuestSystem.isTaskF) { ResetTaskLabe(); QuestSystem.isTaskF = false; } if (!GamePlayer.Instance.GetOpenSubSystemFlag(OpenSubSystemFlag.OSSF_Castle)) { TeamButton.pressedSprite = "duiwuan"; TeamButton.normalSprite = "duiwuan"; } OnQuestUpdateOk(); }
void Awake(){ r_Transform = transform; r_Tweener = GetComponent<UIPlayTween>(); }
IEnumerator CardAction(bool isOne) { ResultAlpha.ResetToBeginning(); yield return(new WaitForSeconds(BoxEffTime)); int childCount = AniObj.transform.childCount; for (int i = 0; i < childCount; i++) { GameObject go = AniObj.transform.GetChild(i).gameObject; Destroy(go); } AniObj.SetActive(false); if (isOne) { ResultOneCard.gameObject.SetActive(true); UIPlayTween tween = ResultOneCard.GetComponent <UIPlayTween>(); tween.tweenGroup = 1; tween.resetOnPlay = true; tween.Play(true); //yield return new WaitForSeconds(alpha.duration+ alpha.delay); } else { ResultCards[0].parent.gameObject.SetActive(true); int length = ResultCards.Length; for (int i = 0; i < length; i++) { ResultCards[i].gameObject.SetActive(false); } int index = 0; bool[] range = new bool[length]; while (index < length) { int count = Random.Range(0, length); if (range[count]) { continue; } range[count] = true; ResultCards[count].gameObject.SetActive(true); UIPlayTween tween = ResultCards[count].GetComponent <UIPlayTween>(); tween.tweenGroup = 1; tween.resetOnPlay = true; tween.Play(true); yield return(new WaitForSeconds(StayTime)); ++index; } } yield return(new WaitForSeconds(CardActionDelay)); ResultAlpha.ResetToBeginning(); ResultAlpha.PlayForward(); if (isOne) { ResultOneCard.collider.enabled = true; UIPlayTween tween = ResultOneCard.GetComponent <UIPlayTween>(); tween.tweenGroup = 2; tween.resetOnPlay = true; tween.Play(true); } else { int length = ResultCards.Length; for (int i = 0; i < length; i++) { Transform tf = ResultCards[i]; tf.collider.enabled = true; UIPlayTween tween = tf.GetComponent <UIPlayTween>(); tween.tweenGroup = 2; tween.resetOnPlay = true; tween.Play(true); } //BtnOpenCard.gameObject.SetActive(true); BtnOpenAllCard.gameObject.SetActive(true); } yield return(new WaitForSeconds(BoxDeleteDelay)); ResultText.SetActive(true); IsAni = false; }
//隐藏层级UI public static void HideLayer(UIPlayTween ui) { Layer.Hide(ui); }
protected override void OnLoad() { base.OnLoad(); mButtonReadMe = FindComponent <UIButton>("mainContainer/Center/ReadMe"); mButtonLeftBtn = FindComponent <UIButton>("mainContainer/Center/PageLeft"); mButtonRightBtn = FindComponent <UIButton>("mainContainer/Center/PageRight"); mLabelMyFight = FindComponent <UILabel>("mainContainer/Bottom/MyFigh"); mLabelMyFightTxt = FindComponent <UILabel>("mainContainer/Bottom/MyFightTxt"); mLabelRecomFight = FindComponent <UILabel>("mainContainer/Bottom/RecomFight"); mLabelScrib = FindComponent <UILabel>("mainContainer/Bottom/Scrib"); mLabelState = FindComponent <UILabel>("mainContainer/Bottom/State/Label"); mButtonOk = FindComponent <UIButton>("mainContainer/Bottom/BtnGrid/OkBtn"); mButtonSweep = FindComponent <UIButton>("mainContainer/Bottom/BtnGrid/Sweep"); mButtonBack = FindComponent <UIButton>("mainContainer/Bottom/BtnGrid/Back"); mButtonDoAgain = FindComponent <UIButton>("mainContainer/Bottom/BtnGrid/DoAgain"); mButtonRank = FindComponent <UIButton>("mainContainer/Bottom/Paihang"); mScrolV = FindComponent <UIScrollView>("mainContainer/Center/Scroll View"); mGridDrop = FindComponent <UIGrid>("mainContainer/Bottom/DropGrid"); mBtnGrid = FindComponent <UIGrid>("mainContainer/Bottom/BtnGrid"); mGridFloor = FindComponent <UIGrid>("mainContainer/Center/Scroll View/Grid"); mSpriteAchieveOne = FindComponent <UISprite>("mainContainer/Bottom/AchieveGrid/Achieve1"); mSpriteAchieveTwo = FindComponent <UISprite>("mainContainer/Bottom/AchieveGrid/Achieve2"); mSpriteAchieveThree = FindComponent <UISprite>("mainContainer/Bottom/AchieveGrid/Achieve3"); mLabelWeekScore = FindComponent <UILabel>("mainContainer/Bottom/WeekScoreNum"); mFirstDrop = FindChild("mainContainer/Bottom/DropGrid/FirstDrop"); mNormalDrop = FindChild("mainContainer/Bottom/DropGrid/SecondDrop"); mBackGround = FindChild("BackGround"); mExamRankItem = FindChild("ViewItem"); mExamRankItem.SetActive(false); mRankTween = FindComponent <UIPlayTween>("rankContainer"); mMainTween = FindComponent <UIPlayTween>("mainContainer"); mRankLeftTween = FindComponent <TweenPosition>("rankContainer/left"); mRankRightTween = FindComponent <TweenPosition>("rankContainer/right"); mMainTweenPos = FindComponent <TweenPosition>("mainContainer"); mMainTween.resetOnPlay = true; mRankTween.resetOnPlay = true; mRankNum = FindComponent <UILabel>("rankContainer/right/ranknum"); mPlayerName = FindComponent <UILabel>("rankContainer/right/playername"); mRankTimer = FindComponent <UILabel>("rankContainer/right/awardIcon/timer"); mShowAwardBtn = FindComponent <UIButton>("rankContainer/right/awardIcon"); mGoToChalBtn = FindComponent <UIButton>("rankContainer/right/GotoChallenge"); mSelfScore = FindComponent <UILabel>("rankContainer/right/scorebg/Label"); mScoreTip = FindComponent <UILabel>("rankContainer/right/tip"); mPreview = FindComponent <UISprite>("rankContainer/right/Preview"); mDizuo = FindComponent <UISprite>("rankContainer/right/dizuo"); mRankGuid = FindComponent <UIGrid>("rankContainer/left/scrollView/itemguid"); mRanAwardPanel = new ChaRankAwardUI(FindChild("RankAwardPanel")); mRanAwardPanel.mGameObject.SetActive(false); mExamChallengeBtn = FindChild("floorinfo"); mExamChallengeBtn.gameObject.SetActive(false); mChalModule = ModuleManager.Instance.FindModule <ChallengeModule>(); mCharacterPreview = new UICharacterPreview(); mCharacterPreview.BackgroundSprite = mDizuo; mCharacterPreview.SetTargetSprite(mPreview); mCharacterPreview.SetCameraOrthographicSize(1.2f); mCharacterPreview.RotationY = 180; mCharacterPreview.Pos = new Vector3(0, 0.3f, 0); mCharacterPreview.Enable = true; //初始化 InitUI(); }