123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class LodingPanelManager : MonoBehaviour
- {
- // Start is called before the first frame update
- public GameObject[] enemyAndFirendlyImage;//选中框集合
- public GameObject[] CheckBoxCheck;// √集合
- public PosCommunication posC;
- public Game3DInputField button3DKey;
- private string userInputName;
- private string playerAction;
- public GameObject showGameObj;
- private int index;
- public GameObject gameManagerObj;
- public GameObject loginEffict, ChangeUImg;
- public AudioSource backgroundMusic;
- public TestGetVoice voice;
- void Start()
- {
- Invoke("StartEffict", 3f);
- button3DKey.text = string.Empty;
- string ip = PlayerPrefs.GetString("ip");//读取本地保存的IP
- if (ip != string.Empty)
- {
- button3DKey.text = ip;
- }
- }
- /// <summary>
- /// 打开特效
- /// </summary>
- public void StartEffict()
- {
- backgroundMusic.Play();
- loginEffict.gameObject.SetActive(true);
- Invoke("OpenScence3", 8f);
- }
- public void OpenScence3()
- {
- // ChangeUImg.SetActive(true);
- // showGameObj.transform.GetChild(0).gameObject.GetComponent<Animator>().SetBool("M2", true);
- userInputName = "TCCCCCCCCCC";
- playerAction = "PlayerUser";
- UserClickUserTypeOfWorkIcon("FriendlyForcesTypeOfWork1");//默认选择陆战编队
- UserClickUserTypeOfWorkIcon("LodingButton");//默认选择陆战编队
- }
- // Update is called once per frame
- void Update()
- {
- }
- public void UserClickUserTypeOfWorkIcon(string TypeOfWork)
- {
- switch (TypeOfWork)
- {
- //case "EnemyTypeOfWork1":
- // posC.player_typeOfWork = TypeOfWork;
- // ChangeBjImage(0);
- // break;
- //case "EnemyTypeOfWork2":
- // posC.player_typeOfWork = TypeOfWork;
- // ChangeBjImage(2);
- // break;
- //case "EnemyTanke":
- // posC.player_typeOfWork = TypeOfWork;
- // ChangeBjImage(1);
- // break;
- case "FriendlyForcesTypeOfWork1":
- posC.player_typeOfWork = TypeOfWork;
- ChangeBjImage(0);
- break;
- case "FriendlyForcesTypeOfWork2":
- posC.player_typeOfWork = TypeOfWork;
- ChangeBjImage(2);
- break;
- case "FriendlyForcesTank":
- posC.player_typeOfWork = TypeOfWork;
- ChangeBjImage(1);
- break;
- case "LodingButton":
- userInputName = button3DKey.text;
- PlayerPrefs.SetString("ip", userInputName);
- //posC.player_name_InputName = userInputName;
- posC.playerAction = playerAction;
- posC.player_ID = UnityEngine.Random.Range(0, 1000000000).ToString(); //随机下标
- posC.player_name_InputName = "FriendlyForcesTypeOfWork1" + "," + posC.player_ID;
- this.gameObject.SetActive(false);
- // showGameObj.SetActive(true);
- gameManagerObj.SetActive(true);
- showGameObj.gameObject.SetActive(true);
- showGameObj.gameObject.transform.position = GameManager.instacne.scence3followPos.transform.position;
- showGameObj.gameObject.transform.eulerAngles = GameManager.instacne.scence3followPos.transform.eulerAngles;
- GameManager.instacne.scenesName = "scenes3";
- loginEffict.gameObject.SetActive(false);
- // 初始化语音识别
- voice.Initialize = true;
- break;
- }
- }
- private void ChangeBjImage(int index)
- {
- for (int i = 0; i < enemyAndFirendlyImage.Length; i++)
- {
- if (i == index)
- {
- enemyAndFirendlyImage[i].GetComponent<MeshRenderer>().material.color = new Color(43f / 255f, 161f / 255f, 33f / 255f);
- CheckBoxCheck[i].gameObject.SetActive(true);
- }
- else
- {
- enemyAndFirendlyImage[i].GetComponent<MeshRenderer>().material.color = new Color(64f / 255f, 64f / 255f, 64f / 255f);
- CheckBoxCheck[i].gameObject.SetActive(false);
- }
- }
- }
- }
|