private void Start() { //===================脚本单例===============================// managerGame = gameObject.GetComponent <Manager_Game>(); managerAudio = gameObject.GetComponent <Manager_Audio>(); managerTime = gameObject.GetComponent <Mannager_Time>(); //===================类的调用=================== mjPlaying = gameObject.GetComponent <FICMJPlaying>(); //================设置按钮点击========================== settingButton = transform.Find("/Game_UI/Fixed_UI/But_SheZhi").GetComponent <Button>(); //================PopUp_UI父物体========================== PopUpUITrans = transform.Find("/Game_UI/PopUp_UI"); JieSanOrQuitButton = PopUpUITrans.Find("SheZhi/Quit").GetComponent <Button>(); JieSanOrQuitText = JieSanOrQuitButton.transform.Find("Text").GetComponent <Text>(); //=============申请解散房间,请投票的panel==================== JieSanPanelTrans = PopUpUITrans.Find("SQ_jiesan"); JieSanTittle = JieSanPanelTrans.Find("Text").GetComponent <Text>(); firstPeoTrans = JieSanPanelTrans.Find("firstPeo"); firstHeadImage = firstPeoTrans.Find("head_2").GetComponent <Image>(); firstStateImage = firstPeoTrans.Find("state_2").GetComponent <Image>(); firstNameText = firstPeoTrans.Find("nickname_2").GetComponent <Text>(); secondPeoTrans = JieSanPanelTrans.Find("secondPeo"); secondHeadImage = secondPeoTrans.Find("head_3").GetComponent <Image>(); secondStateImage = secondPeoTrans.Find("state_3").GetComponent <Image>(); secondNameText = secondPeoTrans.Find("nickname_3").GetComponent <Text>(); thirdPeoTrans = JieSanPanelTrans.Find("thirdPeo"); thirdHeadImage = thirdPeoTrans.Find("head_4").GetComponent <Image>(); thirdStateImage = thirdPeoTrans.Find("state_4").GetComponent <Image>(); thirdNameText = thirdPeoTrans.Find("nickname_4").GetComponent <Text>(); agreeButton = JieSanPanelTrans.Find("Agree").GetComponent <Button>(); //agreeTimeText = agreeButton.transform.Find("time_60").GetComponent<Text>(); refuseButton = JieSanPanelTrans.Find("Refuse").GetComponent <Button>(); //=============警告界面,是否真的解散房间==================== warningJieSanTrans = PopUpUITrans.Find("DD_jiesan"); yesJieSanButton = warningJieSanTrans.Find("Yes_Btn").GetComponent <Button>(); noJieSanButton = warningJieSanTrans.Find("No_Btn").GetComponent <Button>(); //=============申请解散或者退出按钮==================== fanduiPanelTrans = PopUpUITrans.Find("jiesan_SB"); fanduiNamesText = fanduiPanelTrans.Find("Text").GetComponent <Text>(); fanduiNamesStr = null; //==============图片赋值===================== agreeSprit = Resources.Load("Game_GYMJ/Texture/Game_UI/popup_head_yes", typeof(Sprite)) as Sprite; refuseSprit = Resources.Load("Game_GYMJ/Texture/Game_UI/popup_head_no", typeof(Sprite)) as Sprite; //==================按钮事件监听添加=============== settingButton.onClick.AddListener(OnSettingButtonClick); JieSanOrQuitButton.onClick.AddListener(OnJieSanOrQuitButtonClick); //yesJieSanButton.onClick.AddListener(WarningYesButtonClick); //noJieSanButton.onClick.AddListener(WarningNoButtonClick); agreeButton.onClick.AddListener(SendAgreeMessage); refuseButton.onClick.AddListener(SendRefuseMessage); }
/// <summary> /// 初始化 /// </summary> void Start() { //========================================还原语言选择============================================// Mandarin = transform.Find("/Game_UI/PopUp_UI/SheZhi/Language/Mandarin").GetComponent <Toggle>(); Local = transform.Find("/Game_UI/PopUp_UI/SheZhi/Language/Local").GetComponent <Toggle>(); try { Mandarin.isOn = Convert.ToBoolean(PlayerPrefs.GetString("Pop")); Local.isOn = Convert.ToBoolean(PlayerPrefs.GetString("Local")); } catch { } //GameInfo.fangyan = Convert.ToBoolean(PlayerPrefs.GetString("pt")); //GameInfo.fangyan = Convert.ToBoolean(PlayerPrefs.GetString("fangyan")); _ArrayAudioSources = transform.Find("/Audio Source").gameObject.GetComponents <AudioSource>(); if (GameInfo.recon) { gameObject.GetComponent <Reconnection>().clearReturn(); SendRecon(); } managerAudio = GameObject.Find("Main Camera").GetComponent <Manager_Audio>();//单例Manager_Audio脚本 GameUIGO = transform.Find("/Game_UI").gameObject; mjPlaying = gameObject.GetComponent <FICMJPlaying>(); ficjiesan = gameObject.GetComponent <FICjiesan>(); //shezhi.SetActive(false); //进入游戏全屏 Img_setNum = transform.Find("/Game_UI/PopUp_UI/SheZhi").gameObject; SQ_jiesan = transform.Find("/Game_UI/PopUp_UI/SQ_jiesan").gameObject; Room = transform.Find("/Game_UI/Interaction_UI/desktop_UI/Text").GetComponent <Text>(); Room_Id = transform.Find("/Game_UI/Interaction_UI/desktop_UI/Room_Id").GetComponent <Text>(); shareRoomIdButton = Room_Id.transform.Find("btn_shareroom").GetComponent <Button>(); shareRoomIdButton.onClick.AddListener(ShareRoomId); time = transform.Find("/Game_UI/Fixed_UI/Time/Text").GetComponent <Text>(); signal = transform.Find("/Game_UI/Fixed_UI/signal/Text").GetComponent <Text>(); juNum = transform.Find("/Game_UI/Fixed_UI/juNum/Text").GetComponent <Text>(); userTip = transform.Find("/Game_UI/Fixed_UI/userTip_text").GetComponent <Text>(); refresh = transform.Find("/Game_UI/Fixed_UI/But_shuaxin").GetComponent <Button>(); refresh.onClick.AddListener(delegate { ficStartGame.SetRecon(); }); warningPl = GameUIGO.transform.Find("PopUp_UI/warningP").gameObject; warn = GameUIGO.transform.Find("Fixed_UI/warn").gameObject; warningPlInfo = warningPl.transform.Find("info").GetComponent <Text>(); warn.GetComponent <Button>().onClick.AddListener(delegate { ShowSafetyDetection(); }); Head_Mask_E = GameUIGO.transform.Find("Fixed_UI/Heads/Head_east/Head_Mask").GetComponent <Button>(); Head_Mask_W = GameUIGO.transform.Find("Fixed_UI/Heads/Head_west/Head_Mask").GetComponent <Button>(); Head_Mask_S = GameUIGO.transform.Find("Fixed_UI/Heads/Head_south/Head_Mask").GetComponent <Button>(); Head_Mask_N = GameUIGO.transform.Find("Fixed_UI/Heads/Head_north/Head_Mask").GetComponent <Button>(); userInfoPel_E = GameUIGO.transform.Find("PopUp_UI/userInfoPel_E").gameObject; userInfoPel_W = GameUIGO.transform.Find("PopUp_UI/userInfoPel_W").gameObject; userInfoPel_S = GameUIGO.transform.Find("PopUp_UI/userInfoPel_S").gameObject; userInfoPel_N = GameUIGO.transform.Find("PopUp_UI/userInfoPel_N").gameObject; ConnectionStatus_E = GameUIGO.transform.Find("Fixed_UI/Heads/Head_east/ConnectionStatus").gameObject; ConnectionStatus_W = GameUIGO.transform.Find("Fixed_UI/Heads/Head_west/ConnectionStatus").gameObject; ConnectionStatus_S = GameUIGO.transform.Find("Fixed_UI/Heads/Head_south/ConnectionStatus").gameObject; ConnectionStatus_N = GameUIGO.transform.Find("Fixed_UI/Heads/Head_north/ConnectionStatus").gameObject; ray_E = GameUIGO.transform.Find("Fixed_UI/Heads/Head_east/ray").gameObject; ray_W = GameUIGO.transform.Find("Fixed_UI/Heads/Head_west/ray").gameObject; ray_S = GameUIGO.transform.Find("Fixed_UI/Heads/Head_south/ray").gameObject; ray_N = GameUIGO.transform.Find("Fixed_UI/Heads/Head_north/ray").gameObject; integral_E = Head_Mask_E.transform.parent.Find("integral").GetComponent <Text>(); integral_W = Head_Mask_W.transform.parent.Find("integral").GetComponent <Text>(); integral_S = Head_Mask_S.transform.parent.Find("integral").GetComponent <Text>(); integral_N = Head_Mask_N.transform.parent.Find("integral").GetComponent <Text>(); SafetyDetection = transform.Find("/Game_UI/PopUp_UI/SafetyDetection").gameObject; Room_Id.text = GameInfo.room_id.ToString(); if (GameInfo.gameNum >= 2) { Room.gameObject.SetActive(false); Room_Id.gameObject.SetActive(false); } //Room_Id.text +="--"+ Screen.height; //Room_Id.text += "/" + Screen.width; ficStartGame = gameObject.GetComponent <FICStartGame>(); warningPl.transform.Find("yesBtn").GetComponent <Button>().onClick.AddListener(delegate { OnYesButtonClick(); }); warningPl.transform.Find("exitBtn").GetComponent <Button>().onClick.AddListener(delegate { ExitGYMJGame(); }); //usrFD = new Dictionary<int, string>(); allbtnVoice(); }