protected void SendRequest(string rPath, Dict <string, string> rArgs, ServerType rType, Action <WWW> rOnResponse) { var url = HttpServerHost + rPath; useServerType = rType; WaitingLayer.Show(); this.StartCoroutine(GET(url, rArgs, rOnResponse)); }
public static void Show() { if (layer) { return; } layer = Templates.GetDuplicate(key); layer.transform.SetParent(Global.MessageCanvas, false); layer.gameObject.SetActive(true); var rect = layer.GetComponent <RectTransform>(); rect.sizeDelta = new Vector2(100, 100); rect.anchorMin = new Vector2(0.5f, 0.5f); rect.anchorMax = new Vector2(0.5f, 0.5f); rect.pivot = new Vector2(0.5f, 0.5f); rect.anchoredPosition = Vector3.zero; var img = layer.GetComponent <Image>(); /* * if(rotator != null) * { * rotator.Play(); * } * else * { * rotator = img.transform.DORotate(new Vector3(0, 0, 10), 0.2f, RotateMode.Fast).SetLoops(-1, LoopType.Incremental); * } */ if (layer) { modalKey = ModleLayer.Open(layer, color: new Color(0.0f, 0.0f, 0.0f, 0.5f)); } else { modalKey = null; } if (LoadingLayer.IsShow) { layer.transform.SetSiblingIndex(LoadingLayer.GetRenderOrder() - 1); if (modalKey != null) { ModleLayer.SetRenderOrder((int)modalKey, layer.transform.GetSiblingIndex()); } } else { Stick(); } isShow = true; }
public static void Hide() { if (layer) { //rotator.Pause(); Templates.ReturnCache(layer); layer = null; if (modalKey != null) { ModleLayer.Close((int)modalKey); } } isShow = false; }
public static void Hide() { if(layer) { //rotator.Pause(); Templates.ReturnCache(layer); layer = null; if (modalKey != null) { ModleLayer.Close((int)modalKey); } } isShow = false; }
IEnumerator GET(string url, Dict <string, string> rArgs, Action <WWW> rOnResponse) { string Parameters; bool first; if (rArgs.Count > 0) { first = true; Parameters = "?"; foreach (var arg in rArgs) { if (first) { first = false; } else { Parameters += "&"; } Parameters += arg.Key + "=" + arg.Value; } } else { Parameters = ""; } url = url + Parameters; WWW rWWW = new WWW(url); yield return(rWWW); if (rWWW.error != null) { Debug.Log("error :" + rWWW.error); } else { rOnResponse.Invoke(rWWW); rWWW.Dispose(); rWWW = null; } Destroy(this); WaitingLayer.Hide(); }
/// <summary> /// 面板加载完成后的回调 /// </summary> /// <param name="rGo">回传的面板对象</param> protected virtual void OnCreated(GameObject rGo) { WaitingLayer.Hide(); gameObject = rGo; transform = rGo.GetComponent <Transform>(); behaviour = rGo.GetComponent <LShapBehaviour>(); var rPanel = PanelStack.Instance.PanelCurrent; if (gameObject.name.Contains(rPanel.PanelName)) { rPanel.IsCreated = true; DebugConsole.Log("[script match complete]:" + gameObject.name); } else { DebugConsole.Log("[script match failed]:" + gameObject.name); } }
IEnumerator WaitingLayerEnumerator() { yield return(new WaitForSeconds(2)); WaitingLayer.Hide(); }
void TestWaitingLayer() { WaitingLayer.Show(); Global.CoroutineManager.StartTask(WaitingLayerEnumerator()); }
protected virtual void Startup(RectTransform parent, UnityEngine.Events.UnityAction <object> onEnable) { WaitingLayer.Show(); OnEnable = onEnable; }
/// <summary> /// 被原生C#启动 /// </summary> /// <param name="parent">要挂载的UI Window</param> protected virtual void Startup(RectTransform parent) { WaitingLayer.Show(); }
public static void Show() { if (layer) return; layer = Templates.GetDuplicate(key); layer.transform.SetParent(Global.MessageCanvas, false); layer.gameObject.SetActive(true); var rect = layer.GetComponent<RectTransform>(); rect.sizeDelta = new Vector2(100, 100); rect.anchorMin = new Vector2(0.5f, 0.5f); rect.anchorMax = new Vector2(0.5f, 0.5f); rect.pivot = new Vector2(0.5f, 0.5f); rect.anchoredPosition = Vector3.zero; var img = layer.GetComponent<Image>(); /* if(rotator != null) { rotator.Play(); } else { rotator = img.transform.DORotate(new Vector3(0, 0, 10), 0.2f, RotateMode.Fast).SetLoops(-1, LoopType.Incremental); } */ if (layer) { modalKey = ModleLayer.Open(layer, color: new Color(0.0f, 0.0f, 0.0f, 0.5f)); } else { modalKey = null; } if(LoadingLayer.IsShow) { layer.transform.SetSiblingIndex(LoadingLayer.GetRenderOrder() - 1); if (modalKey != null) { ModleLayer.SetRenderOrder((int)modalKey, layer.transform.GetSiblingIndex()); } } else { Stick(); } isShow = true; }