Ejemplo n.º 1
0
    public void AddMenuItemData(IDictionary item)
    {
        if (item["text"] != null)
        {
            this.Text = (string)item["text"];
        }

        if (item["header-image"] != null)
        {
            this.HeaderImage = (string)item["header-image"];
        }

        if (item["tags"] != null)
        {
            foreach (string tag in (IList)item["tags"])
            {
                this.Tags.Add(new Tag {
                    Name = tag
                });
            }
        }

        if (item["menu-items"] != null)
        {
            UIHelper.Instance.addChildView();
            foreach (IDictionary submenu  in (IList)item["menu-items"])
            {
                UIMenuItem submenuItem = new UIMenuItem();
                submenuItem.AddMenuItemData(submenu);
                this.SubMenuItems.Add(submenuItem);
            }
        }
    }
Ejemplo n.º 2
0
    IEnumerator GetMenuData()
    {
        WWW   www         = new WWW("http://dl.dropboxusercontent.com/u/14181582/_temp/sayduckuiconfig.js");
        float elapsedTime = 0.0f;

        while (!www.isDone)
        {
            elapsedTime += Time.deltaTime;
            if (elapsedTime >= 10.0f)
            {
                break;
            }
            yield return(null);
        }

        if (!www.isDone || !string.IsNullOrEmpty(www.error))
        {
            Debug.LogError(string.Format("Fail Whale!\n{0}", www.error));
            yield break;
        }

        string response = www.text;

        IDictionary uiconfig = (IDictionary)Json.Deserialize(response);

        if (uiconfig["menu-items"] != null)
        {
            UIHelper.Instance.addFirstListView();
            //UIHelper.Instance.addChildView(1);

            foreach (IDictionary item in (IList)uiconfig["menu-items"])
            {
                UIMenuItem menuItem = new UIMenuItem();
                menuItem.AddMenuItemData(item);
                Context.RootUIMenuItem.Add(menuItem);
            }
        }
    }
Ejemplo n.º 3
0
    IEnumerator GetMenuData()
    {
        WWW www = new WWW ("http://dl.dropboxusercontent.com/u/14181582/_temp/sayduckuiconfig.js");
        float elapsedTime = 0.0f;

        while (!www.isDone) {
            elapsedTime += Time.deltaTime;
            if (elapsedTime >= 10.0f)
                break;
            yield return null;
        }

        if (!www.isDone || !string.IsNullOrEmpty (www.error))
        {
            Debug.LogError (string.Format ("Fail Whale!\n{0}", www.error));
            yield break;

        }

        string response = www.text;

        IDictionary uiconfig = (IDictionary)Json.Deserialize (response);

        if (uiconfig["menu-items"] != null) {

            UIHelper.Instance.addFirstListView();
            //UIHelper.Instance.addChildView(1);

            foreach (IDictionary item in (IList)uiconfig["menu-items"])
            {
                UIMenuItem menuItem = new UIMenuItem();
                menuItem.AddMenuItemData(item);
                Context.RootUIMenuItem.Add(menuItem);
            }
        }
    }
Ejemplo n.º 4
0
    public void AddMenuItemData(IDictionary item)
    {
        if (item["text"] != null)
        {
            this.Text = (string)item["text"];
        }

        if (item["header-image"] != null)
        {
            this.HeaderImage = (string)item["header-image"];
        }

        if (item["tags"] != null)
        {
            foreach (string tag in (IList)item["tags"])
            {
                this.Tags.Add (new Tag {Name = tag});
            }

        }

        if (item["menu-items"] != null)
        {
            UIHelper.Instance.addChildView();
            foreach (IDictionary submenu  in (IList)item["menu-items"])
            {
                UIMenuItem submenuItem = new UIMenuItem();
                submenuItem.AddMenuItemData(submenu);
                this.SubMenuItems.Add(submenuItem);
            }
        }
    }