Exemplo n.º 1
0
    public TimeLinePage(XmlNodeList milestones, MenuElement menuElement)
    {
        _totalItemNum	= milestones.Count;
        _totalHeight	= (_totalItemNum - 1) * 25;
        _menuElement	= menuElement;

        texture	= _menuElement.GetTextureById("timelinebg");
        Debug.Log("w="+texture.width+", h="+texture.height);
        for (int i=0; i<_totalItemNum; i++){
            TimeLineItem item = new TimeLineItem(_menuElement);
            item.setLabel(_menuElement.GetTextureById(milestones[i].Attributes["time"].Value));

            addItem(item);

            Sprite itemImg	= new Sprite(_menuElement.GetTextureById(milestones[i].Attributes["pic"].Value));
            _itemImgAry.Add(itemImg);
            addChild(itemImg);

            Sprite itemTxt	= new Sprite(_menuElement.GetTextureById(milestones[i].Attributes["text"].Value));
            _itemTxtAry.Add(itemTxt);
            addChild(itemTxt);
            itemTxt.alpha	= 0.0f;
            itemTxt.y		= 640f;
            itemTxt.x		= (_texture.width-itemTxt.width)/2-20;
        }
        this.addEventListner(GuiEvent.CHANGE, new EventDispatcher.CallBack(selectChangeHandler));
        //this.addEventListner(GuiEvent.ENTER_FRAME,new EventDispatcher.CallBack(enterFrameHandler));
        selectItemByIndex(_totalItemNum-1);
    }
Exemplo n.º 2
0
 public SelectableItemEx(XmlNode node, MenuElement menuElement)
 {
     XmlNode bg = node.SelectSingleNode("component");
     if (bg == null){
         Debug.Log("XXXXXXXX");
         Texture2D texture = Resources.Load("page/"+node.Attributes["src"].Value, typeof(Texture2D)) as Texture2D;
         setTexutre(texture, 1024f, 686f);
     }
     else{
         Texture2D texture = Resources.Load("page/pbg", typeof(Texture2D)) as Texture2D;
         setTexutre(texture, 1024f, 686f);
         XmlNodeList cs = bg.SelectNodes("c");
         foreach (XmlNode c in cs){
             Texture2D tex = menuElement.GetTextureById(c.Attributes["src"].Value);
             float x = float.Parse(c.Attributes["x"].Value);
             float y = float.Parse(c.Attributes["y"].Value);
             float w = float.Parse(c.Attributes["w"].Value);
             float h = float.Parse(c.Attributes["h"].Value);
             Sprite s = new Sprite(tex, w, h);
             s.x = x;
             s.y = y;
             addChild(s);
         }
     }
 }
Exemplo n.º 3
0
 public TimeLineItem(MenuElement menuElement)
 {
     _bg= new Sprite(menuElement.GetTextureById("timelinearrow"));
     _bg.scaleY	= .4f;
     _bg.x		= 80;
     _bg.y		= -5;
     addChild(_bg);
     this.addEventListner(GuiEvent.SELECT,selectHandler);
     this.addEventListner(GuiEvent.UNSELECT,unselectHandler);
 }