public static HS_LuaBehaviour Open(string uiPrefabName, LuaTable luaTable) { if (mRoot == null) { Debugger.LogError("Have No UI root gameObject."); return(null); } View view; int index; HS_LuaBehaviour t = Get(uiPrefabName, out view, out index); if (t == null) { GameObject srcGo = HS_ResourceManager.LoadAsset <GameObject>(uiPrefabName); //GameObject go = GameObject.Instantiate(srcGo); bool b = luaTable.RawGet <string, bool>("IForward"); GameObject go = UIAddChild(b ? mTagForward : mTagNormal, srcGo); t = go.AddComponent <HS_LuaBehaviour>(); t.Attach(luaTable); view = new View(t); mViews.Add(view); HS_ViewBase.InternalOpened(view.view); } GameObject rootCanvas = (t is IForward) ? mTagForward : mTagNormal; view.view.transform.SetSiblingIndex(rootCanvas.transform.childCount - 1); if (t is IForwardModalles) { mMaskHolder++; mTagMask.transform.SetSiblingIndex(view.view.transform.GetSiblingIndex() - 1); mTagMask.GetComponent <Image>().color = defaultMaskColor; mTagMask.transform.localScale = Vector3.one; (t as IForwardModalles).CustomMask(mTagMask.transform); mTagMask.GetComponent <Button>().onClick.AddListener(delegate { (t as IForwardModalles).MaskClickHandle(); }); } return(t); }
public AudioSource PlaySound(string clipName, bool simpleTube = false) { return(PlaySound(HS_ResourceManager.LoadAsset <AudioClip>(clipName), 1f, 1f, simpleTube)); }
public AudioSource PlayMusic(string clipName, bool loop = true) { return(PlayMusic(HS_ResourceManager.LoadAsset <AudioClip>(clipName), 1f, 1f, loop)); }