public void InitData(CreateRoleUIData data) { //RoleDescribe.text = " " + LanguageTextManager.GetString(data._IntroText); RoleIcon.spriteName = data._HeadIcon; this.HeroNameEditor.SetHeroSex((byte)data._VocationID); MyRoleData = data; InitRoleStarList(); }
void SelectRole(object obj) { var vocation = (int)obj; BreakRoleEvent(); for (int i = 0; i < m_createRoleData.Count; i++) { if (m_createRoleData[i]._VocationID == vocation) { m_selectRoleData = m_createRoleData[i]; } } if (m_createRolePanel != null) { Destroy(m_createRolePanel.gameObject); m_createRolePanel = null; } for (int i = 0; i < m_curRoleEffectList.Count; i++) { if (m_curRoleEffectList[i] != null) { Destroy(m_curRoleEffectList[i]); } } m_curRoleEffectList.Clear(); CancelInvoke(); Invoke("CreateRoleUI", m_selectRoleData._UIDelayTime); m_eventList.Clear(); GameObject.Destroy(m_continueNextTips); for (int i = 0; i < m_selectRoleData._AnimList.Length; i++) { RoleEvent evt = new RoleEvent(); evt.Type = RoleEventType.PlayAnim; evt.m_handled = true; evt.EventTimeAfterLaunch = 0.0f; evt.Param = i; m_eventList.Add(evt); } RoleEvent evt1 = new RoleEvent(); evt1.Type = RoleEventType.PlaySoundEffect; evt1.m_handled = true; evt1.Param = m_selectRoleData._SoundEffectList.Length == 0 ? 0 : Random.Range(0, m_selectRoleData._SoundEffectList.Length); evt1.EventTimeAfterLaunch = 0; m_eventList.Add(evt1); for (int i = 0; i < m_selectRoleData._EffectDelayTime.Length; i++) { RoleEvent evt = new RoleEvent(); evt.Type = RoleEventType.PlayEffect; evt.m_handled = true; evt.Param = i; evt.EventTimeAfterLaunch = m_selectRoleData._EffectDelayTime[i] * 0.001f; m_eventList.Add(evt); } m_onSelect = true; }
private static void PostprocessCreateRoleUIDataList(string xmlFileName, string sheetName) { string xmlPath = Path.Combine(RESOURCE_CHARACTER_DATA_FOLDER, xmlFileName + ".xml"); TextReader tr = new StreamReader(xmlPath); string text = tr.ReadToEnd(); if (string.IsNullOrEmpty(text)) { Debug.LogError("Player generate config file not exist"); return; } else { XmlSpreadSheetReader.ReadSheet(text, sheetName); XmlSpreadSheet sheet = XmlSpreadSheetReader.Output; string[] keys = XmlSpreadSheetReader.Keys; object[] levelIds = sheet[keys[0]]; List <CreateRoleUIData> tempList = new List <CreateRoleUIData>(); for (int i = 2; i < levelIds.Length; i++) { CreateRoleUIData data = new CreateRoleUIData(); data._VocationID = Convert.ToInt32(sheet["VocationID"][i]); data._HeadIcon = Convert.ToString(sheet["Picture"][i]); data._VocationIcon = Convert.ToString(sheet["VocationIcon"][i]); string roleModelName = Convert.ToString(sheet["RoleModel"][i]); string path = Path.Combine("Assets/Prefab/NPC/Prefab", roleModelName + ".prefab"); data._RoleModel = AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)) as GameObject; string[] charPosStr = Convert.ToString(sheet["CharPos"][i]).Split('+'); data._RolePosition = new Vector3(Convert.ToSingle(charPosStr[1]), 0, Convert.ToSingle(charPosStr[3])); //string[] selectAnimStr = Convert.ToString(sheet["SelectAnim"][i]).Split('|'); //data._SelectAnim = new string[selectAnimStr.Length]; //for (int j = 0; j < selectAnimStr.Length; j++) //{ // data._SelectAnim[j] = Convert.ToString(selectAnimStr[j]); //} //string[] selectAnimSoundStr = Convert.ToString(sheet["SelectAnimSound"][i]).Split('|'); //data._SelectAnimSound = new SelectSound[selectAnimSoundStr.Length]; //for (int j = 0; j < selectAnimSoundStr.Length; j++) //{ // string[] selectSoundStr = Convert.ToString(selectAnimSoundStr[j]).Split('+'); // data._SelectAnimSound[j] = new SelectSound(); // data._SelectAnimSound[j].SoundName = Convert.ToString(selectSoundStr[0]); // data._SelectAnimSound[j].DalayTime = Convert.ToSingle(selectSoundStr[1]); //} data._InitAnim = Convert.ToString(sheet["Animations"][i]); string[] charAnimStr = Convert.ToString(sheet["Animations_Go"][i]).Split('|'); data._AnimList = new string[charAnimStr.Length]; for (int j = 0; j < charAnimStr.Length; j++) { string[] animStr = Convert.ToString(charAnimStr[j]).Split('+'); data._AnimList[j] = Convert.ToString(animStr[0]); } data._StopAnim = Convert.ToString(sheet["Animations_Idle"][i]); data._BackAnim = Convert.ToString(sheet["Animations_Back"][i]); data._IntroText = Convert.ToString(sheet["Introductions"][i]); string[] effectNameStr = Convert.ToString(sheet["EffectName"][i]).Split('+'); data._EffectList = new GameObject[effectNameStr.Length]; for (int j = 0; j < effectNameStr.Length; j++) { string effectPath = Path.Combine("Assets\\Effects\\Prefab", effectNameStr[j] + ".prefab"); data._EffectList[j] = AssetDatabase.LoadAssetAtPath(effectPath, typeof(GameObject)) as GameObject; } string[] effectDelayTimeStr = Convert.ToString(sheet["EffectTime"][i]).Split('+'); data._EffectDelayTime = new float[effectDelayTimeStr.Length]; for (int j = 0; j < effectDelayTimeStr.Length; j++) { data._EffectDelayTime[j] = Convert.ToSingle(effectDelayTimeStr[j]); } data._SoundEffectList = Convert.ToString(sheet["ChooseVoice"][i]).Split('+'); string[] cameraPos = Convert.ToString(sheet["CameraPos"][i]).Split('+'); data._CameraPosition = new Vector3(Convert.ToSingle(cameraPos[1]), Convert.ToSingle(cameraPos[2]), Convert.ToSingle(cameraPos[3])); string[] cameraTarget = Convert.ToString(sheet["CameraTargetPos"][i]).Split('+'); data._CameraTarget = new Vector3(Convert.ToSingle(cameraTarget[1]), Convert.ToSingle(cameraTarget[2]), Convert.ToSingle(cameraTarget[3])); data._UIDelayTime = Convert.ToSingle(sheet["UIAppearTime"][i]) * 0.001f; string[] abilityStr = Convert.ToString(sheet["PlayerAbility"][i]).Split('+'); data.PlayerAbility = new List <int>(); abilityStr.ApplyAllItem(P => data.PlayerAbility.Add(int.Parse(P))); tempList.Add(data); } CreateRoleUIDataList(tempList); } }