void Awake() { NGUILink link = this.gameObject.GetComponent(typeof(NGUILink)) as NGUILink; Camera = CLauncherUI.Get(link, "Camera"); Camera.SetActive(false); }
public override void OnInspectorGUI() { NGUILink link = target as NGUILink; GUI.changed = false; if (link.Links != null) { RegisterUndo("NGUILink Change", link); for (int i = 0; i < link.Links.Count; i++) { NGUILink.UILink uilink = link.Links[i]; GameObject linkobj = uilink.LinkObj; if (!linkobj) { uilink.Name = errostr; continue; } if (linkobj) { if (string.IsNullOrEmpty(uilink.Name) || uilink.Name == errostr) { uilink.Name = linkobj.name; } if (!uilink.component || uilink.component.gameObject != linkobj.gameObject) { uilink.component = linkobj.gameObject.GetComponent <MonoBehaviour>(); } } } EditorUtility.SetDirty(link); } base.OnInspectorGUI(); }
public override void Initialize() { NGUILink link = this.gameObject.GetComponent(typeof(NGUILink)) as NGUILink; Bar = link.Get <Slider>("ProgressSlider"); ProgressLabel = link.Get <Text>("ProgressLabel"); Tips = link.Get <Text>("Tips"); }
public static GameObject Get(NGUILink self, string name) { self.DoInitIfDont(); UILink link = null; self.all_objs.TryGetValue(name, out link); if (link == null) { return(null); } return(link.LinkObj); }
void Awake() { NGUILink link = this.gameObject.GetComponent(typeof(NGUILink)) as NGUILink; if (link == null) { return; } Loaderbar = this.gameObject.AddComponent(typeof(CLoaderUI)) as CLoaderUI; pValueDisposable = Progress.Instance.ObserveEveryValueChanged(p => p.progress).Subscribe(p => Loaderbar.SetProgress(p)); }
void Awake() { NGUILink link = this.gameObject.GetComponent(typeof(NGUILink)) as NGUILink; ProgressLabel = Get(link, "ProgressLabel").GetComponent <Text>(); Tips = Get(link, "Tips").GetComponent <Text>(); Messagebox = Get(link, "Messagebox"); Messagebox.SetActive(false); link = this.Messagebox.GetComponent(typeof(NGUILink)) as NGUILink; Msg = Get(link, "msg").GetComponent <CText>(); Ok = Get(link, "FirstBtn").GetComponent <Button>(); Cancel = Get(link, "SecondBtn").GetComponent <Button>(); Ok.onClick.AddListener(OnOkClick); Cancel.onClick.AddListener(OnCancelClick); }
private static void AddGameObjectToLink() { UnityEngine.GameObject select = Selection.activeGameObject; if (select == null) { return; } if (!select.activeInHierarchy) { Debug.LogError(string.Format("【NGUILink】自动添加对象失败:请先激活需要添加的对象和NGUILink对象", select.name), select); return; } NGUILink link = FindInParents <NGUILink>(select.transform); if (link == null) { Debug.LogError(string.Format("【NGUILink】自动添加对象失败:{0}父节点无NGUILink组件", select.name), select); return; } if (link.gameObject == select && select.transform.parent != null) { link = FindInParents <NGUILink>(select.transform.parent); } if (link == null) { Debug.LogError(string.Format("【NGUILink】自动添加对象失败:{0}父节点无NGUILink组件", select.name), select); return; } link.ReBuildLinkMap(); if (link.Get(select.name) == null) { NGUILink.UILink item = new NGUILink.UILink(); item.Name = select.name; item.LinkObj = select; link.Links.Add(item); Debug.Log(string.Format("【NGUILink】自动添加对象成功:{0} NGUILink:{1}", select.name, link.name), link); } else { Debug.LogError(string.Format("【NGUILink】自动添加对象失败:已经存在重复名字{0}的对象 NGUILink:{1}", select.name, link.name), link); } }