//添加选项 void addOptions() { for (int i = 0; i < currentGameEvent.options.Length; i++) { GameObject option = (GameObject)MonoBehaviour.Instantiate(optionGameObject); option.name = string.Format("option{0}", i); option.transform.parent = optionBackgroundImage.gameObject.transform; RectTransform rectTransform = option.GetComponent <RectTransform> (); rectTransform.anchorMin = Vector2.one * 0.5f; rectTransform.anchorMax = Vector2.one * 0.5f; float width = backgroundImage.rectTransform.sizeDelta.x * 0.75f; float height = width / 5.0f; rectTransform.sizeDelta = new Vector2(width, height); rectTransform.pivot = Vector2.one * 0.5f; rectTransform.localScale = Vector3.one; float posY = (currentGameEvent.options.Length - 1) * height / 2.0f - (height * (float)i); Debug.Log(width + "," + height + "," + posY); rectTransform.anchoredPosition3D = new Vector3(0, posY, 0); Text optionText = rectTransform.FindChild("text").gameObject.GetComponent <Text>(); if (optionText != null) { optionText.text = currentGameEvent.options [i].text; UUIEventListener.Get(option, currentGameEvent.options [i].tag).onClickTag = optionClick; } } }
static int Get(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1 && TypeChecker.CheckTypes <UnityEngine.Transform>(L, 1)) { UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.ToObject(L, 1); UUIEventListener o = UUIEventListener.Get(arg0); ToLua.Push(L, o); return(1); } else if (count == 1 && TypeChecker.CheckTypes <UnityEngine.GameObject>(L, 1)) { UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1); UUIEventListener o = UUIEventListener.Get(arg0); ToLua.Push(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UUIEventListener.Get")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void OnShowBattleResult(UUIEventListener listener) { m_isShowingItems = !m_isShowingItems; if (m_isShowingItems) { List <PlayerBaseCtrl> list = EntryManager.instance.GetAllPlayerSorted(); for (int i = 0; i < list.Count; i++) { if (list[i].isMine && i >= m_itemList.Count) { list[m_itemList.Count - 1] = list[i]; } } m_lastPlayersCount = Mathf.Min(m_itemList.Count, list.Count); for (int i = 0; i < m_lastPlayersCount; i++) { m_itemList[i].SetData((i + 1).ToString(), list[i].playerName, list[i].level.ToString(), list[i].isMine); m_itemList[i].Show(0.15f * i); } } else { for (int i = 0; i < m_lastPlayersCount; i++) { m_itemList[m_lastPlayersCount - i - 1].Hide(0.15f * i); } } }
public void OnValueChange(UUIEventListener listener) {//设为true的时候才调用 if (callback != null) { callback(id); } }
void Start() { //MapUtil.GetInstance.DrawGrid (); Application.targetFrameRate = 30; GlobalConfig.GetInstance.InitGlobalSetting(); // GameObject.Find ("frame1").SetActive (false); // GameObject.Find ("frame2").SetActive (false); // GameObject.Find ("frame3").SetActive (false); // GameObject.Find ("frame4").SetActive (false); // GameObject.Find ("frame5").SetActive (false); loadingImage = GameObject.Find("Loading"); btnHFAttack = GameObject.Find("btnHFAttack"); btnStart = GameObject.Find("btnStart"); btnMXUlt = GameObject.Find("btnMX"); btnLEUlt = GameObject.Find("btnLE"); btnHMUlt = GameObject.Find("btnHM"); btnODUlt = GameObject.Find("btnOD"); btnRRUlt = GameObject.Find("btnRR"); btnTimer = GameObject.Find("btnTimer"); btnLEUlt.SetActive(false); btnRRUlt.SetActive(false); // UUIEventListener.Get (btnHFAttack).onClick = btn1ClickHandler; // // // UUIEventListener.Get (btnODAttack).onClick = btnAttackHandler; // UUIEventListener.Get (btnMXAttack).onClick = btnAttackHandler; // UUIEventListener.Get (btnLEAttack).onClick = btnAttackHandler; // UUIEventListener.Get (btnHMAttack).onClick = btnAttackHandler; UUIEventListener.Get(btnODUlt).onClick = BtnUtlHandler; UUIEventListener.Get(btnMXUlt).onClick = BtnUtlHandler; //UUIEventListener.Get (btnLEUlt).onClick = BtnUtlHandler; UUIEventListener.Get(btnHMUlt).onClick = BtnUtlHandler; //UUIEventListener.Get (btnRRUlt).onClick = BtnUtlHandler; //UUIEventListener.Get (btnStart).onClick = BtnStartClickHandler; UUIEventListener.Get(loadingImage).onDrag = LoadingDragHandler; UUIEventListener.Get(btnTimer).onClick = BtnTimerHandler; //MessageCenter.GetInstance.addEventListener (BaseEvent.CLICK, btn1ClickHandler); MainComponentManager main = MainComponentManager.SharedInstance; BattleManager battle = BattleManager.SharedInstance; // StartCoroutine (DelayToInvokeDo (2.0f)); //播放第一段背景音乐 AudioManager.SharedInstance.PlaySound("Bgmusic_01", 1.0f); }
static public UUIEventListener Get(GameObject go) { UUIEventListener listener = go.GetComponent <UUIEventListener>(); if (listener == null) { listener = go.AddComponent <UUIEventListener>(); } return(listener); }
static public UUIEventListener Get(GameObject go, AudioIDEnum audioID = AudioIDEnum.none) { UUIEventListener listener = go.GetComponent <UUIEventListener>(); if (listener == null) { listener = go.AddComponent <UUIEventListener>(); } listener.audioEnum = audioID; return(listener); }
static public UUIEventListener Get(GameObject go, int tag_) { UUIEventListener listener = go.GetComponent <UUIEventListener>(); if (listener == null) { listener = go.AddComponent <UUIEventListener>(); } listener.tagInt = tag_; return(listener); }
static public UUIEventListener Get(Transform tf) { GameObject go = tf.gameObject; UUIEventListener listener = go.GetComponent <UUIEventListener>(); if (listener == null) { listener = go.AddComponent <UUIEventListener>(); } return(listener); }
static public UUIEventListener Get(GameObject go, bool isShowEffect = true) { UUIEventListener listener = go.GetComponent <UUIEventListener>(); if (listener == null) { listener = go.AddComponent <UUIEventListener>(); } listener.showEffect = isShowEffect; listener.scale = go.transform.localScale; return(listener); }
static int OnPointerExit(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UUIEventListener obj = (UUIEventListener)ToLua.CheckObject <UUIEventListener>(L, 1); UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject <UnityEngine.EventSystems.PointerEventData>(L, 2); obj.OnPointerExit(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void Start() { //Screen.SetResolution(750,1333,false); //PlayerSettings.SetAspectRatio(AspectRatio.Aspect16by9,true);没用 UUIEventListener.Get(speedUpText.gameObject).onClick = speedUp; UUIEventListener.Get(nextImage.gameObject).onClick = next; UUIEventListener.Get(backgroundImage.gameObject).onClick = next; UUIEventListener.Get(textBackgroundImage.gameObject).onClick = next; UUIEventListener.Get(roleImage.gameObject).onClick = next; UUIEventListener.Get(speedUpText.gameObject).onClick = speedUp; JsonUtility.FromJsonOverwrite(GameJSON.text, this); setCurrentTag(startTag); optionBackgroundImage.gameObject.SetActive(false); }
static int get_onLongPressDown(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UUIEventListener obj = (UUIEventListener)o; UUIEventListener.VoidDelegate ret = obj.onLongPressDown; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onLongPressDown on a nil value")); } }
static int get_parameter(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UUIEventListener obj = (UUIEventListener)o; object ret = obj.parameter; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index parameter on a nil value")); } }
static int set_parameter(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UUIEventListener obj = (UUIEventListener)o; object arg0 = ToLua.ToVarObject(L, 2); obj.parameter = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index parameter on a nil value")); } }
static int set_onLongPressDown(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UUIEventListener obj = (UUIEventListener)o; UUIEventListener.VoidDelegate arg0 = (UUIEventListener.VoidDelegate)ToLua.CheckDelegate <UUIEventListener.VoidDelegate>(L, 2); obj.onLongPressDown = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onLongPressDown on a nil value")); } }
void OnScreenDrag(UUIEventListener listener) { if (mainBall == null) { return; } Vector2 delta = UIHelper.GetListenerDelta(listener); mainBall.Rotate(Vector3.up, delta.x); m_cameraCtrl.RotateX(delta.y); //m_mainCamera.transform.position = Vector3.Lerp(m_mainCamera.transform.position, transform.position + cameraPos, 0.5f); //m_mainCamera.transform.forward = mainBall.forward; //Vector3 eulr = Camera.main.transform.rotation.eulerAngles; //eulr.x -= delta.y; //Camera.main.transform.rotation = Quaternion.Euler(eulr); }
void RegisterEvent() { UUIEventListener.Get(_start).onClick = StartBtn; UUIEventListener.Get(_pause).onClick = PauseBtn; GameObject quit = _canvas.transform.Find("quit").gameObject; UUIEventListener.Get(quit).onClick = QuitBtn; GameObject com = _canvas.transform.Find("com").gameObject; UUIEventListener.Get(com).onClick = ComBtn; GameObject leftRight = _canvas.transform.Find("LeftRight").gameObject; UUIEventListener.Get(leftRight).onClick = leftRightBtn; GameObject UpDown = _canvas.transform.Find("UpDown").gameObject; UUIEventListener.Get(UpDown).onClick = UpdownBtn; GameObject replay = _canvas.transform.Find("rePlay").gameObject; UUIEventListener.Get(replay).onClick = ReplayBtn; GameObject localVideo = _canvas.transform.Find("LocalVideo").gameObject; UUIEventListener.Get(localVideo).onClick = LocalVideoBtn; _hightVideoSprite = localVideo.GetComponent <Image>().sprite; _localVideo = localVideo.GetComponent <Image>(); GameObject netVideo = _canvas.transform.Find("NetVideo").gameObject; UUIEventListener.Get(netVideo).onClick = NetVideoBtn; _netVideo = netVideo.GetComponent <Image>(); _oldVideoSprite = _netVideo.sprite; _netVideo.sprite = _hightVideoSprite; //默认是网络 _localVideo.sprite = _oldVideoSprite; }
public static Vector2 GetListenerVirtualDelta(UUIEventListener listener) { return(FormatToVirtual(GetListenerDelta(listener))); }
public static Vector2 GetListenerDelta(UUIEventListener listener) { return(listener.pointerEventData.delta); }
public static Vector2 GetListenerPos(UUIEventListener listener) { return(listener.pointerEventData.position); }
public void RegOnDrop(VoidDelegate cb) { UUIEventListener.Get(gameObject).onDrop = OnDrop; onDrop = cb; }
public void RegOnUpdateSelected(VoidDelegate cb) { UUIEventListener.Get(gameObject).onUpdateSelect = OnUpdateSelected; onUpdateSelect = cb; }
public void RegOnDeselect(VoidDelegate cb) { UUIEventListener.Get(gameObject).onDeSelect = OnDeselect; onDeSelect = cb; }
public void RegOnScroll(VoidDelegate cb) { UUIEventListener.Get(gameObject).onScroll = OnScroll; onScroll = cb; }
public void RegOnBeginDrag(VoidDelegate cb) { UUIEventListener.Get(gameObject).onDragBegin = OnBeginDrag; onDragBegin = cb; }
// Use this for initialization void Start() { Debug.Log(PlayerPrefs.GetInt("endTag")); UUIEventListener.Get(replayImage.gameObject).onClick = rePlay; }
// Use this for initialization void Start() { UUIEventListener.Get(startImage.gameObject).onClick = jumpToScene1; }
public void RegOnMove(VoidDelegate cb) { UUIEventListener.Get(gameObject).onMove = OnMove; onMove = cb; }
public void RegOnEndDrag(VoidDelegate cb) { UUIEventListener.Get(gameObject).onDragEnd = OnEndDrag; onDragEnd = cb; }