/// <summary> /// 匿名方法 /// </summary> /// <param name="name"></param> public void lamada(string name) { Transform transf = buttonBehind.transform.Find(name); if (name.Contains("customServe")) { transf.localPosition = new Vector3(transf.localPosition.x, transf.localPosition.y, 0); } else { transf.localScale = Vector3.one; } #if UNITY_IOS if (transf.name.Contains("customServe")) { if (UnitySendMessageToiOS.Instante().checkInstallWeChat() != 0 && weiXinLoad.instance.AndroidFunction == false) { Transform transf2 = transf.GetChild(3).GetChild(1); for (int i = 2; i < 6; ++i) { transf2.GetChild(i).GetChild(1).localScale = Vector3.zero; } } } #endif RootCanvas.find("backGround").transform.localScale = Vector3.one;//显示阴影背景 }
/// <summary> /// 绑定切换提现界面 /// </summary> void close_() { if (WithDraw_Sp.instance.return_blind == true) { if (GameObject.Find("mobileBindle").transform.localScale == Vector3.one) { GameObject.Find("Withdraw").transform.localScale = Vector3.one; } else { GameObject.Find("Withdraw").transform.localScale = Vector3.zero; RootCanvas.find("backGround").transform.localScale = Vector3.zero;//显示阴影背景 } GameObject.Find("mobileBindle").transform.localScale = Vector3.zero; WithDraw_Sp.instance.return_blind = false; GameObject.Find("yanZhengMa_InputField").GetComponent <InputField>().text = null; } else { for (int i = 0; i < buttonBehind.transform.childCount; ++i) { buttonBehind.transform.GetChild(i).localScale = Vector3.zero; } RootCanvas.find("backGround").transform.localScale = Vector3.zero;//显示阴影背景 } }
//====================================================================== /// <summary> /// 手机绑定 /// </summary> /// <param name="g"></param> void phoneBindle() { if (netConnect.instance.m_state == login_state.wechat) { buttonBehind.transform.Find("mobileBindle").localScale = Vector3.one; buttonBehind.transform.Find("accountBindle").localScale = Vector3.zero; RootCanvas.find("backGround").transform.localScale = Vector3.one;//显示阴影背景 } else { netConnect.Ani(15); } }
/// <summary> /// 按钮方法 /// </summary> /// <param name="g"></param> public void close(GameObject g) { if (g.name.Contains("cus_Close")) { g.transform.parent.transform.localPosition = new Vector3(g.transform.parent.transform.localPosition.x, g.transform.parent.transform.localPosition.y, -100000); } else { g.transform.parent.gameObject.transform.localScale = Vector3.zero; } RootCanvas.find("backGround").transform.localScale = Vector3.zero;//把阴影背景缩放为零 RootCanvas.canvas_group(GameObject.Find("Canvas_button").GetComponent <CanvasGroup>(), false, 0); }
/// <summary> /// 用来控制对象的隐藏或显示 /// 可以完成某个对象缩放成0到1的隐藏和显示 /// </summary> /// <param name="name"></param> /// <param name="f"></param> public static void setActive(string name, bool f) { GameObject obj = RootCanvas.find(name); if (obj != null) { if (obj.transform.localScale.x <= 0) { obj.transform.localScale = f ? Vector3.one : Vector3.zero; } else { obj.SetActive(f); } } }
public static void setScale(string name, Vector3 value) { RootCanvas.find(name).transform.localScale = value; }
public static T GetComponentForName <T>(string name) { return(RootCanvas.find(name).GetComponent <T>()); }