Inheritance: MonoBehaviour, ITemplatable
コード例 #1
0
    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));
    }
コード例 #2
0
    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;
    }
コード例 #3
0
 public static void Hide()
 {
     if (layer)
     {
         //rotator.Pause();
         Templates.ReturnCache(layer);
         layer = null;
         if (modalKey != null)
         {
             ModleLayer.Close((int)modalKey);
         }
     }
     isShow = false;
 }
コード例 #4
0
ファイル: WaitingLayer.cs プロジェクト: meta-42/uEasyKit
 public static void Hide()
 {
     if(layer)
     {
         //rotator.Pause();
         Templates.ReturnCache(layer);
         layer = null;
         if (modalKey != null)
         {
             ModleLayer.Close((int)modalKey);
         }
     }
     isShow = false;
 }
コード例 #5
0
    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();
    }
コード例 #6
0
ファイル: UILogic.cs プロジェクト: zsy3105/UnityFramework
        /// <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);
            }
        }
コード例 #7
0
        IEnumerator WaitingLayerEnumerator()
        {
            yield return(new WaitForSeconds(2));

            WaitingLayer.Hide();
        }
コード例 #8
0
 void TestWaitingLayer()
 {
     WaitingLayer.Show();
     Global.CoroutineManager.StartTask(WaitingLayerEnumerator());
 }
コード例 #9
0
ファイル: UILogic.cs プロジェクト: zsy3105/UnityFramework
 protected virtual void Startup(RectTransform parent, UnityEngine.Events.UnityAction <object> onEnable)
 {
     WaitingLayer.Show();
     OnEnable = onEnable;
 }
コード例 #10
0
ファイル: UILogic.cs プロジェクト: zsy3105/UnityFramework
 /// <summary>
 /// 被原生C#启动
 /// </summary>
 /// <param name="parent">要挂载的UI Window</param>
 protected virtual void Startup(RectTransform parent)
 {
     WaitingLayer.Show();
 }
コード例 #11
0
ファイル: WaitingLayer.cs プロジェクト: meta-42/uEasyKit
    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;
    }