/// <summary> /// 初始化选择英雄面板 /// </summary> /// <param name="heroIds"></param> public void InitSelectHeroPanel(int[] heroIds) { GameObject go; foreach (int id in heroIds) { if (idHeroDict.ContainsKey(id)) { continue; } go = Instantiate(UIHero); UIHero hero = go.GetComponent <UIHero>(); hero.InitView(HeroData.GetHeroData(id)); go.transform.SetParent(heroParent); go.transform.localScale = Vector3.one; idHeroDict.Add(id, hero); } }
/// <summary> /// 初始化英雄选择面板 /// </summary> /// <param name="heroIds"></param> public void InitSelectHeroPanel(int[] heroIds) { GameObject go; for (int i = 0; i < heroIds.Length; i++) { if (idHeroDict.ContainsKey(heroIds[i])) { continue; } go = Instantiate(UIHero); UIHero hero = go.GetComponent <UIHero>(); hero.InitView(HeroData.GetHeroData(heroIds[i])); go.transform.SetParent(heroParent, false); go.transform.localScale = Vector3.one; idHeroDict.Add(heroIds[i], hero); } }
/// <summary> /// 初始化选择英雄面板,开启选人计时 /// </summary> public void InitSelectHeroPanel(int[] heroIDs) { GameObject hero; for (int i = 0; i < heroIDs.Length; i++) { if (uiHeroes.ContainsKey(heroIDs[i])) { continue; } hero = Instantiate(heroPrefab); UIHero uiHero = hero.GetComponent <UIHero>(); uiHero.InitView(HeroData.GetHeroDataModel(heroIDs[i])); hero.transform.SetParent(heroPanel.transform); hero.transform.localScale = Vector3.one; uiHeroes.Add(heroIDs[i], uiHero); } timerStart = true; timer = 60; }
void OnDestroy() { instance = null; rootArray = null; cameraArray = null; lobbyPanelPathArray = null; uiLobby = null; uiLobbyButton = null; uiMessageBox = null; uiHero = null; uiSkill = null; uiBullet = null; uiGoldShop = null; uiCashShop = null; uiLobbyButton = null; lobbyTabGroup = null; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. this.spriteBatch = new SpriteBatch(GraphicsDevice); this.spriteData = new SpriteData(); this.background = Content.Load <Texture2D>(@"Content\Background"); SpriteInitializer.InitializeSprites(this.spriteData, Content); this.emoticon = new Emoticon("OnfireEmoticon"); this.sprite = spriteData.DuplicateSprite(this.emoticon.Name); this.uiEmoticon = new UIEmoticon(this.sprite, this.emoticon); this.uiEmoticon.Sprite.AnimationIndex = 3; this.hero = new Hero("LightHero"); this.sprite = spriteData.DuplicateSprite(this.hero.Name); this.uiHero = new UIHero(this.sprite, this.hero); StartGame(); }
private void LoadUICompleteCB(GameObject gameObj, System.Guid uid, params object[] param) { if (gameObj != null) { GameObject createObj = Instantiate(gameObj) as GameObject; createObj.transform.parent = rootArray[(int)eRootType.Type_Back].transform; createObj.transform.localPosition = Vector3.zero; createObj.transform.localScale = gameObj.transform.localScale; switch ((eUIType)param[0]) { case eUIType.Type_Lobby: uiLobby = createObj.GetComponent <UILobby>(); break; case eUIType.Type_Lobby_Button: uiLobbyButton = createObj.GetComponent <UILobbyButton>(); break; case eUIType.Type_MessageBox: uiMessageBox = createObj.GetComponent <UIMessageBox>(); break; case eUIType.Type_Waiting: uiWaiting = createObj.GetComponent <UIWaiting>(); break; case eUIType.Type_Hero: uiHero = createObj.GetComponent <UIHero>(); if (lobbyTabGroup != null) { lobbyTabGroup[(int)eUILobbyTab.Type_Hero] = uiHero; } break; case eUIType.Type_Skill: uiSkill = createObj.GetComponent <UISkill>(); if (lobbyTabGroup != null) { lobbyTabGroup[(int)eUILobbyTab.Type_Skill] = uiSkill; } break; case eUIType.Type_Weapon: uiBullet = createObj.GetComponent <UIBullet>(); if (lobbyTabGroup != null) { lobbyTabGroup[(int)eUILobbyTab.Type_Weapon] = uiBullet; } break; case eUIType.Type_Gold: uiGoldShop = createObj.GetComponent <UIGoldShop>(); if (lobbyTabGroup != null) { lobbyTabGroup[(int)eUILobbyTab.Type_Gold] = uiGoldShop; } break; case eUIType.Type_Gem: uiCashShop = createObj.GetComponent <UICashShop>(); if (lobbyTabGroup != null) { lobbyTabGroup[(int)eUILobbyTab.Type_Gem] = uiCashShop; } break; } } }