コード例 #1
0
 public SceneSelect()
 {
     base.init();
     #region SanguoCommander4
     //����ͼ
     CCSprite background = CCSprite.spriteWithSpriteFrameName("bg_select.png");
     background.anchorPoint = new CCPoint(0, 0);
     this.addChild(background);
     //���ذ�ť
     CCMenuItemSprite btn_back = CCMenuItemSprite.itemFromNormalSprite(
         CCSprite.spriteWithSpriteFrameName("btn_back1.png"),
         CCSprite.spriteWithSpriteFrameName("btn_back2.png"),
         this, click_back);
     CCMenu menu = CCMenu.menuWithItems(btn_back);
     menu.position = new CCPoint(666, 32);
     this.addChild(menu);
     //�����Tab��ť����
     CCMenuItemSprite tab1 = CCMenuItemSprite.itemFromNormalSprite(
         CCSprite.spriteWithSpriteFrameName("tab_shu2.png"),
         CCSprite.spriteWithSpriteFrameName("tab_shu1.png"),
         CCSprite.spriteWithSpriteFrameName("tab_shu1.png"),
         this, click_story_tab);
     CCMenuItemSprite tab2 = CCMenuItemSprite.itemFromNormalSprite(
         CCSprite.spriteWithSpriteFrameName("tab_wu2.png"),
         CCSprite.spriteWithSpriteFrameName("tab_wu1.png"),
         CCSprite.spriteWithSpriteFrameName("tab_wu1.png"),
         this, click_story_tab);
     CCMenuItemSprite tab3 = CCMenuItemSprite.itemFromNormalSprite(
         CCSprite.spriteWithSpriteFrameName("tab_wei2.png"),
         CCSprite.spriteWithSpriteFrameName("tab_wei1.png"),
         CCSprite.spriteWithSpriteFrameName("tab_wei1.png"),
         this, click_story_tab);
     story_tabs = CCMenu.menuWithItems(tab1, tab2, tab3);
     //����ˮƽ����10�����ؼ��ָ�
     story_tabs.alignItemsHorizontallyWithPadding(10);
     //ת��Ϊ����UI������
     story_tabs.position = CCDirector.sharedDirector().convertToUI(new CCPoint(300, 72));
     //����һ������Ϊ���ɵ��
     tab1.Enabled = false;
     this.addChild(story_tabs);
     //��Ӳ��Բ�
     //this.addChild(new LayerLevels());
     //����ǩ��Ӧ����ͬ��LyerLevers ����
     dictLayerLevels.Add(tab1, new LayerLevels() { visible = false });
     dictLayerLevels.Add(tab2, new LayerLevels() { visible = false });
     dictLayerLevels.Add(tab3, new LayerLevels() { visible = false });
     //��tab1��ʾΪ��ǰ�Ĺؿ���
     showLayerLevels(dictLayerLevels[tab1]);
     //��������ӵ�������
     foreach (var item in dictLayerLevels.Values)
     {
         this.addChild(item);
     }
     #endregion
 }