// Use this for initialization protected void Start() { sceneController = (FirstControl)Director.getInstance().sceneCtrl; diskFactory = sceneController.factory; scoreRecorder = sceneController.scoreRecorder; //sceneController.MyActionManager = this; sceneController.myAdapter.SetNormalAM(this); }
public void Begin() { LoadPrefabs(); MyActionManager = gameObject.AddComponent <ActionManager>() as ActionManager; Debug.Log(MyActionManager); scoreRecorder = gameObject.AddComponent <RecordControl>(); user = gameObject.AddComponent <UserGUI>(); user.Begin(); }
/// <summary> /// 加载 UI /// </summary> void LoadUI() { // 加载 游戏 菜单 预制体 menuControl = NGUITools.AddChild(uiRoot3D, Resources.Load <GameObject>("Panel - Menu")).AddComponent <MenuControl>(); // 加载 UI 预制体 uiControl = NGUITools.AddChild(uiRoot, Resources.Load <GameObject>("Panel - UI")).AddComponent <UIControl>(); // 加载 显示纪录 预制体 recordControl = NGUITools.AddChild(uiRoot, Resources.Load <GameObject>("Panel - Record")).AddComponent <RecordControl>(); }
protected override void OnAwakeInitUI() { _instance = this; if (mUIGameModel == null) { mUIGameModel = UIModelMgr.Instance.GetModel <UIGameModel>(); mUIGameModel.ValueUpdateEvent += OnValueUpdateEvent; } if (mUIMainModel == null) { mUIMainModel = UIModelMgr.Instance.GetModel <UIMainModel>(); } mPublicGroupMgr = CacheTrans.FindComponent <PublicGroupMgr>("Root/PublicGroup"); mLabelSeqCount = CacheTrans.FindComponent <UILabel>("Root/PublicGroup/RunGroup/LabelSeqCount"); mLabelCardNum = CacheTrans.FindComponent <UILabel>("Root/PublicGroup/RunGroup/LabelCardNum"); mGameTableItem = CacheTrans.FindComponent <GameTableItem>("Root/PublicGroup/RunGroup/GameTable"); mRecordControl = CacheTrans.FindComponent <RecordControl>("Root/PublicGroup/RunGroup/RecordControl"); mJingCardItems = CacheTrans.FindChindComponents <CardItem>("Root/PublicGroup/RunGroup/ContainerTop/JingCards"); mOpenCardItems = CacheTrans.FindChindComponents <CardItem>("Root/PublicGroup/RunGroup/OpenCardItems"); if (mPlayerItems == null) { mPlayerItems = new List <PlayerInfoItem>(); } mPlayerItems.Add(CacheTrans.FindComponent <PlayerInfoItem>("Root/ContainerBottom/PlayerInfo")); mPlayerItems.Add(CacheTrans.FindComponent <PlayerInfoItem>("Root/ContainerRight/PlayerInfo")); mPlayerItems.Add(CacheTrans.FindComponent <PlayerInfoItem>("Root/ContainerTop/PlayerInfo")); mPlayerItems.Add(CacheTrans.FindComponent <PlayerInfoItem>("Root/ContainerLeft/PlayerInfo")); if (mPlayerCardGroupList == null) { mPlayerCardGroupList = new List <PlayerCardGroupItem>(); } mPlayerCardGroupList.Add(CacheTrans.FindComponent <PlayerCardGroupItem>("Root/ContainerBottom/PlayerCardGroup")); mPlayerCardGroupList.Add(CacheTrans.FindComponent <PlayerCardGroupItem>("Root/ContainerRight/PlayerCardGroup")); mPlayerCardGroupList.Add(CacheTrans.FindComponent <PlayerCardGroupItem>("Root/ContainerTop/PlayerCardGroup")); mPlayerCardGroupList.Add(CacheTrans.FindComponent <PlayerCardGroupItem>("Root/ContainerLeft/PlayerCardGroup")); mVoiceAnimation = CacheTrans.FindComponent <UISpriteAnimation>("Root/PublicGroup/VoiceAnimation"); #region 注册按钮的点击方法 mBtnDissolveRoom = CacheTrans.FindComponent <UIButton>("Root/PublicGroup/PrepareGroup/ContainerRight/BtnDissolveRoom"); mBtnLeaveRoom = CacheTrans.FindComponent <UIButton>("Root/PublicGroup/PrepareGroup/ContainerRight/BtnLeaveRoom"); UIEventListener.Get(mBtnDissolveRoom.gameObject).onClick += OnDissolveRoomClick; UIEventListener.Get(mBtnLeaveRoom.gameObject).onClick += OnDissolveRoomClick; CacheTrans.GetUIEventListener("Root/PublicGroup/PrepareGroup/ContainerRight/BtnReturnHall").onClick += OnReturnHallClick; CacheTrans.GetUIEventListener("Root/PublicGroup/PrepareGroup/BtnWeChat").onClick += OnWeChatClick; CacheTrans.GetUIEventListener("Root/PublicGroup/RunGroup/ContainerRight/BtnSetting").onClick += OnSettingClick; CacheTrans.GetUIEventListener("Root/PublicGroup/RunGroup/ContainerRight/BtnTextChat").onClick += OnChatClick; CacheTrans.GetUIEventListener("Root/PublicGroup/RunGroup/ContainerRight/BtnExpression").onClick += OnExpressionClick; CacheTrans.GetUIEventListener("Root/PublicGroup/ContainerRight/BtnVoiceChat").onPress += OnRecording; #endregion 注册按钮的点击方法 SetVoiceAnimation(false); }