public void Awake(GameObject parent)
        {
            microphone = Game.Scene.GetComponent <MicrophoneComponent>();
            res        = ETModel.Game.Scene.GetComponent <ResourcesComponent>();
            res.LoadBundle(UICowCowAB.CowCow_Prefabs);
            res.LoadBundle(UICowCowAB.CowCow_Texture);
            GameObject ab = (GameObject)res.GetAsset(UICowCowAB.CowCow_Prefabs, UICowCowType.CowCowGameSetting);

            this.GameObject = UnityEngine.Object.Instantiate(ab);
            this.GameObject.transform.SetParent(parent.transform, false);
            this.GameObject.name = UICowCowType.CowCowGameSetting;

            ReferenceCollector rc = this.GameObject.GetComponent <ReferenceCollector>();

            uiVoiceSetting = rc.Get <GameObject>("UIVoiceSetting").GetComponent <CanvasGroup>();
            musicSlider    = rc.Get <GameObject>("MusicSlider").GetComponent <Slider>();
            soundSlider    = rc.Get <GameObject>("SoundSlider").GetComponent <Slider>();
            musicSwitchBtn = rc.Get <GameObject>("MusicSwitchButton").GetComponent <Button>();
            soundSwitchBtn = rc.Get <GameObject>("SoundSwitchButton").GetComponent <Button>();
            Button helpBtn    = rc.Get <GameObject>("HelpBtn").GetComponent <Button>();
            Button comfirmBtn = rc.Get <GameObject>("ComfirmBtn").GetComponent <Button>();

            uiHelp = rc.Get <GameObject>("UIHelp").GetComponent <CanvasGroup>();
            Button hCloseBtn = rc.Get <GameObject>("HCloseBtn").GetComponent <Button>();

            musicSlider.onValueChanged.Add(OnMusicSlider);
            soundSlider.onValueChanged.Add(OnSoundSlider);
            musicSwitchBtn.onClick.Add(OnMusicSwitch);
            soundSwitchBtn.onClick.Add(OnSoundSwitch);
            helpBtn.onClick.Add(OnHelp);
            comfirmBtn.onClick.Add(OnComfirm);
            hCloseBtn.onClick.Add(OnHClose);
        }
Exemplo n.º 2
0
        public void Awake(GameObject parent, GamerInfo info, int posIndex)
        {
            res = ETModel.Game.Scene.GetComponent <ResourcesComponent>();
            res.LoadBundle(UICowCowAB.CowCow_Texture);
            res.LoadBundle(UICowCowAB.CowCow_SoundOther);
            microphone     = Game.Scene.GetComponent <MicrophoneComponent>();
            this.Status    = (UIGamerStatus)info.Status;
            this.gamerName = info.Name;
            UIGameInfo     = GamerFactory.Create(UICowCowType.CowCowGamerInfo);
            UIGameInfo.transform.SetParent(parent.transform, false);
            UIGameInfo.name = UICowCowType.CowCowGamerInfo;
            ReferenceCollector rc = UIGameInfo.GetComponent <ReferenceCollector>();

            Image headIcon = rc.Get <GameObject>("HeadIcon").GetComponent <Image>();

            headIcon.transform.localPosition = GamerData.Pos[posIndex].HeadPos;
            Text gamerNames = rc.Get <GameObject>("Names").GetComponent <Text>();

            coin     = rc.Get <GameObject>("Coin").GetComponent <Text>();
            status   = rc.Get <GameObject>("Status").GetComponent <Text>();
            cowType  = rc.Get <GameObject>("CowType").GetComponent <Text>();
            HandCard = rc.Get <GameObject>("HandCard").GetComponent <CanvasGroup>();
            HandCard.transform.localPosition = GamerData.Pos[posIndex].CardPos;
            for (int i = 0; i < cards.Length; i++)
            {
                cards[i] = rc.Get <GameObject>("Card" + i).GetComponent <Image>();
            }
            promptBtn = rc.Get <GameObject>("PromptBtn").GetComponent <Button>();
            submitBtn = rc.Get <GameObject>("SubmitBtn").GetComponent <Button>();

            emoji      = rc.Get <GameObject>("Emoji").GetComponent <Image>();
            chatBG     = rc.Get <GameObject>("ChatBG").GetComponent <CanvasGroup>();
            chatText   = rc.Get <GameObject>("ChatText").GetComponent <Text>();
            bankerIcon = rc.Get <GameObject>("BankerIcon").GetComponent <Image>();
            chatBG.transform.localPosition = GamerData.Pos[posIndex].ChatPosData.Pos;
            chatBG.transform.Rotate(GamerData.Pos[posIndex].ChatPosData.Rotate);
            chatText.transform.Rotate(GamerData.Pos[posIndex].ChatPosData.Rotate);


            promptBtn.onClick.Add(OnPrompt);
            submitBtn.onClick.Add(OnSubmit);
            gamerNames.text = info.Name;
            this.SetCoin(info.Coin.ToString());
            this.Sex = info.Sex;
            //headIcon.sprite = info.HeadIcon;
        }