//添加选项 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 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); }
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); }
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 void RegOnBeginDrag(VoidDelegate cb) { UUIEventListener.Get(gameObject).onDragBegin = OnBeginDrag; onDragBegin = cb; }
public void RegOnDrop(VoidDelegate cb) { UUIEventListener.Get(gameObject).onDrop = OnDrop; onDrop = cb; }
public void RegOnEndDrag(VoidDelegate cb) { UUIEventListener.Get(gameObject).onDragEnd = OnEndDrag; onDragEnd = cb; }
public void RegOnDeselect(VoidDelegate cb) { UUIEventListener.Get(gameObject).onDeSelect = OnDeselect; onDeSelect = cb; }
// Use this for initialization void Start() { //GameObject go = startImage.gameObject; //Debug.Log ("" + go.ToString ()); UUIEventListener.Get(startImage.gameObject).onClick = jumpToScene1; }
// Use this for initialization void Start() { UUIEventListener.Get(startImage.gameObject).onClick = jumpToScene1; }
public void RegOnEnter(VoidDelegate cb) { UUIEventListener.Get(gameObject).onEnter = OnPointerEnter; onEnter = cb; }
public void RegOnDown(VoidDelegate cb) { UUIEventListener.Get(gameObject).onDown = OnPointerDown; onDown = cb; }
public void RegOnClick(VoidDelegate cb) { UUIEventListener.Get(gameObject).onClick = OnPointerClick; onClick = cb; }
void Start() { instance = this; UUIEventListener.Get(showLogButton.gameObject).onClick = _ => logPanel.gameObject.SetActive(!logPanel.gameObject.activeSelf); DontDestroyOnLoad(transformParent.gameObject); }
public void RegOnScroll(VoidDelegate cb) { UUIEventListener.Get(gameObject).onScroll = OnScroll; onScroll = cb; }
public void RegOnMove(VoidDelegate cb) { UUIEventListener.Get(gameObject).onMove = OnMove; onMove = cb; }
public void RegOnExit(VoidDelegate cb) { UUIEventListener.Get(gameObject).onExit = OnPointerExit; onExit = cb; }
// Use this for initialization void Start() { Debug.Log(PlayerPrefs.GetInt("endTag")); UUIEventListener.Get(replayImage.gameObject).onClick = rePlay; }
public void RegOnUp(VoidDelegate cb) { UUIEventListener.Get(gameObject).onUp = OnPointerUp; onUp = cb; }
public void RegOnUpdateSelected(VoidDelegate cb) { UUIEventListener.Get(gameObject).onUpdateSelect = OnUpdateSelected; onUpdateSelect = cb; }
static public UUIEventListener Get(Transform go) { return(UUIEventListener.Get(go.gameObject)); }