示例#1
0
        public async void SetPanel(GameObject panel, int index)
        {
            this.Panel = panel;

            _rf = this.Panel.GetComponent <ReferenceCollector>();

            this.index = index;

            this.subGameInfo = DataCenterComponent.Instance.gameInfo.SubGameInfoList[index];

            this.gameId = subGameInfo.GameID;

            //是否已经下载 0:未下载 1:已下载
            //this.HasLoaded = PlayerPrefs.GetInt("subGame" + this.gameId, 0) == 0 ? false : true;

            //是否需要下载
            this.NeddLoad = subGameInfo.NeedLoad;

            //是否可玩
            this.IsOpen = subGameInfo.IsOpen;

            this.LoadSlider = _rf.Get <GameObject>("LoadSlider");

            this.UpdateFlag = _rf.Get <GameObject>("UpdateFlag").GetComponent <Button>();

            this.sliderFg = _rf.Get <GameObject>("sliderFg").GetComponent <Image>();

            this.sliderValue = _rf.Get <GameObject>("sliderValue").GetComponent <Text>();

            this.enter = this.Panel.transform.GetChild(0).GetComponent <Button>();

            this.UpdateFlag.onClick.AddListener(() =>
            {
                ResGroupLoadComponent.Instance.Load(subGameInfo.PrefabName);
            });

            // this.Init();
        }
示例#2
0
        public GameLobbyGameListPlugin Awake(GameObject panel)
        {
            this.panel = panel;

            this._GameListsDialog = this.panel;

            this._rf = this.panel.GetComponent <ReferenceCollector>();

            this.lobby = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIHallPanel).GetComponent <GameLobbyCpt>();

            this.SubGameDic = new Dictionary <int, SubGame>();

            this.SubGameModelDic = new Dictionary <int, ETModel.SubGame>();

            this.subGameComponentDic = new Dictionary <int, SubGameComponent>();

            this.SubGameModelLoadUIDic = new Dictionary <int, ResGroupLoadUIComponent>();

            var subGameInfoList = DataCenterComponent.Instance.gameInfo.SubGameInfoList;

            for (int i = 0; i < subGameInfoList.Count; i++)
            {
                SubGameInfo subGameInfo = subGameInfoList[i];

                SubGame subGame = SubGameFactory.Create(subGameInfo.GameID, subGameInfo.Index, this);

                SubGameDic[i] = subGame;

                GameObject subGameIcon = _rf.Get <GameObject>(subGameInfo.PrefabName);

                subGame.GetComponent <SubGameComponent>().SetPanel(subGameIcon, subGameInfo.Index);

                subGameComponentDic[i] = subGame.GetComponent <SubGameComponent>();

                //创建MODEL层子游戏

                ETModel.SubGame subGameModel = ETModel.SubGameFactory.Create(subGameInfo.GameID, subGameInfo.Index);

                SubGameModelDic[i] = subGameModel;

                subGameModel.GetComponent <ResGroupLoadUIComponent>().SetPanel(subGameIcon, subGameModel.Index);

                SubGameModelLoadUIDic[i] = subGameModel.GetComponent <ResGroupLoadUIComponent>();
            }

            #region Find

            this._GameType = _rf.Get <GameObject>("GameType");

            //this.ZJHButton = _rf.Get<GameObject>("ZJHButton");

            //this.NiuNiuButton = _rf.Get<GameObject>("NiuNiuButton");

            //this.BJLButton = _rf.Get<GameObject>("BJLButton");

            //this.DZButton = _rf.Get<GameObject>("DZButton");

            //this.HongHeiButton = _rf.Get<GameObject>("HongHeiButton");

            //this.LongHDButton = _rf.Get<GameObject>("LHDButton");

            this.DDZButton = _rf.Get <GameObject>("DDZButton");

            //this.SGJButton = _rf.Get<GameObject>("SGJButton");

            //this.QZNNButton = _rf.Get<GameObject>("QZNNButton");


            //ButtonHelper.RegisterButtonEvent(_rf, "NiuNiuButton", () =>
            //{
            //    Game.PopupComponent.SetClickLock();

            //    this.OnNiuNiuButton(); }
            //);

            //ButtonHelper.RegisterButtonEvent(_rf, "HongHeiButton", () =>
            //{
            //    Game.PopupComponent.SetClickLock();

            //    //this.OnHongHeiButton();

            //    Game.EventSystem.Run(EventIdType.HongHeiEnterGameModule);
            //}
            //);

            //ButtonHelper.RegisterButtonEvent(_rf, "LHDButton", () =>
            //{
            //    Game.PopupComponent.SetClickLock();

            //    Game.EventSystem.Run(EventIdType.OnEnterNHDGameModule);
            //});

            //ButtonHelper.RegisterButtonEvent(_rf, "BJLButton", () =>
            //{
            //    Game.PopupComponent.SetClickLock();

            //    Game.EventSystem.Run(EventIdType.OnEnterBJLGameModule);
            //});

            //ButtonHelper.RegisterButtonEvent(_rf, "DZButton", () =>
            //{
            //    Game.PopupComponent.SetClickLock();

            //    this.OnDZButton();
            //});

            //ButtonHelper.RegisterButtonEvent(_rf, "QZNNButton", () =>
            //{
            //    Game.PopupComponent.SetClickLock();

            //    Game.EventSystem.Run(EventIdType.OnEnterQZNNGameModule, lobby.GameLobbyGameListPlugin._GameType, lobby.GameLobbyGameTypeSelectPlugin._BackGameListsButton);
            //});

            //ButtonHelper.RegisterButtonEvent(_rf, "ZJHButton", () =>
            //{
            //    Game.PopupComponent.SetClickLock();

            //    this.OnZJHButton();
            //});

            //ButtonHelper.RegisterButtonEvent(_rf, "SGJButton", () =>
            //{
            //    Game.PopupComponent.SetClickLock();

            //    this.OnSGJButton();
            //});

            ButtonHelper.RegisterButtonEvent(_rf, "DDZButton", () =>
            {
                Game.PopupComponent.SetClickLock();
                Game.EventSystem.Run(EventIdType.OnEnterDDZGameModule);
            });

            #endregion

            this.SetAnimationEffect();

            this.InitSubGameResGroup();

            this.InitSubGameUpdate();

            return(this);
        }