Core/NetworkPackage/DTCFile/ServerPack/HAD_SaleActivity.meta
New file @@ -0,0 +1,9 @@ fileFormatVersion: 2 guid: 3e05761d690b75440a6be79207d0fb01 folderAsset: yes timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/DTCFile/ServerPack/HAE_Truck.meta
New file @@ -0,0 +1,9 @@ fileFormatVersion: 2 guid: 1d70ccd06161e0443b7a802ad94292f8 folderAsset: yes timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/DTCFile/ServerPack/HAF_Merge.meta
New file @@ -0,0 +1,9 @@ fileFormatVersion: 2 guid: 71e878ac60c49ad4f964dd2dbc725739 folderAsset: yes timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/DTCFile/ServerPack/HB0_Event.meta
New file @@ -0,0 +1,9 @@ fileFormatVersion: 2 guid: eed34091b0568664b9fb42f0634496c1 folderAsset: yes timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ServerPack/HAD_SaleActivity.meta
New file @@ -0,0 +1,9 @@ fileFormatVersion: 2 guid: 32ceb8b7faf99f84a8b73ce53c5e3e4d folderAsset: yes timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ServerPack/HAE_Truck.meta
New file @@ -0,0 +1,9 @@ fileFormatVersion: 2 guid: 77f69c2b862d1704299a32d0d8eeb71e folderAsset: yes timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ServerPack/HAF_Merge.meta
New file @@ -0,0 +1,9 @@ fileFormatVersion: 2 guid: fa14960fa44b0d1439bab471a764e34f folderAsset: yes timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ServerPack/HB0_Event.meta
New file @@ -0,0 +1,9 @@ fileFormatVersion: 2 guid: d914565b65f8e8145988734c4d915834 folderAsset: yes timeCreated: 1547643019 licenseType: Pro DefaultImporter: userData: assetBundleName: assetBundleVariant: Core/ResModule/InstanceResourcesLoader.cs
@@ -193,7 +193,6 @@ return null; } public static void LoadCreateRole(int job, Action<bool, UnityEngine.Object> _callBack) { string _name = "Zs"; Core/ResModule/SceneLoader.cs
@@ -5,6 +5,30 @@ public class SceneLoader { public static GameObject LoadCreateRole(string name) { GameObject prefab = null; if (AssetSource.sceneFromEditor) { #if UNITY_EDITOR var path = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath, "Scene/CreateRole/", name, ".prefab"); prefab = UnityEditor.AssetDatabase.LoadAssetAtPath<GameObject>(path); #endif } else { var assetInfo = new AssetInfo("maps/createrole", name); prefab = AssetBundleUtility.Instance.Sync_LoadAsset(assetInfo) as GameObject; } if (prefab == null) { DebugEx.LogErrorFormat("SceneLoader.LoadCreateRole() => 加载不到资源: {0}.", name); } return prefab; } public static Texture2D LoadTexture(string folder, string name) { Texture2D texture2D = null; Fight/Stage/CreateRoleStage.cs
@@ -31,7 +31,8 @@ protected override void OnStageLoadFinish() { base.OnStageLoadFinish(); WindowCenter.Instance.Open<CreateRoleWin>(true); CreateRoleManager.Instance.StarShow(); WindowCenter.Instance.Close<LaunchBackGroundWin>(); } @@ -39,11 +40,8 @@ { base.UnInitialize(); CreateRoleManager.Instance.Dispose(); WindowCenter.Instance.Close<CreateRoleWin>(); #if !UNITY_EDITOR AssetBundleUtility.Instance.UnloadAssetBundle("mob/createrole", true, true); #endif } } Fight/Stage/SelectRoleStage.cs
@@ -24,9 +24,6 @@ { InGameDownLoad.Instance.TryDownLoad(InGameDownLoad.Dominant.None); } //屏蔽职业特效预先加载逻,以减少不必要的内存损耗和获得更快的场景切换速度,资源压缩使用LZ4才行。 // AssetPreLoad.Instance.PreLoadJobEffect(PlayerDatas.Instance.loginInfo.Job); } public override void UnInitialize() System/CreateRole.meta
New file @@ -0,0 +1,9 @@ fileFormatVersion: 2 guid: acd47e44c9a384044aef0466db699e20 folderAsset: yes timeCreated: 1554861231 licenseType: Pro DefaultImporter: userData: assetBundleName: assetBundleVariant: System/CreateRole/CreateRoleBehaviour.cs
New file @@ -0,0 +1,198 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using Snxxz.UI; public class CreateRoleBehaviour : MonoBehaviour { [SerializeField] int m_Job; [SerializeField] EnterPictureType m_EnterPictureType; [SerializeField] ShowAnimation m_EnterShowAnimation; [SerializeField] ShowAnimation m_RoutimeShowAnimation; [SerializeField] Effect[] m_PersistentEffect; [SerializeField] Effect[] m_EnterShowEffect; [SerializeField] Effect[] m_RoutimeShowEffect; [SerializeField] CreateRoleHeroPlatform m_Platform; [SerializeField] ActorShadowCaster m_Shadow; CreateRoleTimeLine showTimeLine = new CreateRoleTimeLine(); public State state { get; private set; } List<SFXController> sfxControllers = new List<SFXController>(); public void DoEnterShow() { CreateRoleManager.Instance.LoadModel(m_Job, (bool ok, UnityEngine.Object @object) => { if (ok) { var model = @object as GameObject; model.transform.SetParentEx(m_Platform.transform, Vector3.zero, Quaternion.identity, Vector3.one); m_Shadow.Cast(model.transform); model.SetActive(true); ReleaseEffects(); state = State.EnterShow; showTimeLine.ClearNode(); foreach (var effect in m_PersistentEffect) { showTimeLine.AddNone(effect.delay, () => { PlayEffect(model.transform, effect); }); } foreach (var effect in m_EnterShowEffect) { showTimeLine.AddNone(effect.delay, () => { PlayEffect(model.transform, effect); }); } showTimeLine.AddNone(m_EnterShowAnimation.delay, () => { var animator = model.GetComponent<Animator>(); animator.Play(m_EnterShowAnimation.animation); }); showTimeLine.AddNone(5f, () => { WindowCenter.Instance.Open<CreateRoleWin>(); }); showTimeLine.OnComplete(() => { state = State.Idle; }); showTimeLine.Begin(); } }); } public void DoRoutineShow() { CreateRoleManager.Instance.LoadModel(m_Job, (bool ok, UnityEngine.Object @object) => { if (ok) { var model = @object as GameObject; model.transform.SetParentEx(m_Platform.transform, Vector3.zero, Quaternion.identity, Vector3.one); switch (m_EnterPictureType) { case EnterPictureType.OutIn: model.SetActive(false); break; case EnterPictureType.Stand: model.SetActive(true); m_Shadow.Cast(model.transform); break; } ReleaseEffects(); state = State.RoutimeShow; showTimeLine.ClearNode(); showTimeLine.AddNone(m_RoutimeShowAnimation.delay, () => { if (m_EnterPictureType == EnterPictureType.OutIn) { model.SetActive(true); m_Shadow.Cast(model.transform); } var animator = model.GetComponent<Animator>(); animator.Play(m_RoutimeShowAnimation.animation); }); foreach (var effect in m_PersistentEffect) { showTimeLine.AddNone(effect.delay, () => { PlayEffect(model.transform, effect); }); } foreach (var effect in m_RoutimeShowEffect) { showTimeLine.AddNone(effect.delay, () => { PlayEffect(model.transform, effect); }); } showTimeLine.AddNone(2f, () => { WindowCenter.Instance.Open<CreateRoleWin>(); }); showTimeLine.OnComplete(() => { state = State.Idle; }); showTimeLine.Begin(); } }); } public void Dispose() { showTimeLine.Dispose(); ReleaseEffects(); } private void PlayEffect(Transform model, Effect effect) { var config = EffectConfig.Get(effect.id); Transform parent = null; if (!string.IsNullOrEmpty(config.nodeName)) { parent = model.transform.GetChildTransformDeeply(config.nodeName); } else { parent = model.transform; } sfxControllers.Add(SFXPlayUtility.Instance.Play(effect.id, parent)); } public void ReleaseEffects() { for (var i = sfxControllers.Count - 1; i >= 0; i--) { SFXPlayUtility.Instance.Release(sfxControllers[i]); } sfxControllers.Clear(); } [System.Serializable] public struct ShowAnimation { public string animation; public float delay; } [System.Serializable] public struct Effect { public int id; public float delay; } public enum EnterPictureType { Stand, OutIn, } public enum State { Idle, EnterShow, RoutimeShow, } } System/CreateRole/CreateRoleBehaviour.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 94bce01d1e0ec5749aab4069a3c81613 timeCreated: 1554861327 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CreateRole/CreateRoleManager.cs
New file @@ -0,0 +1,93 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using System; public class CreateRoleManager : Singleton<CreateRoleManager> { CreateRoleProcessor m_Processor; CreateRoleProcessor processor { get { return m_Processor ?? (m_Processor = GameObject.FindObjectOfType<CreateRoleProcessor>()); } } Dictionary<int, GameObject> jobModels = new Dictionary<int, GameObject>(); public readonly LogicInt selectedJob = new LogicInt(); public void StarShow() { selectedJob.value = 1; processor.LoadNecessaryResources(); processor.DoEnterShow(); } public void View(int job) { selectedJob.value = job; switch (job) { case 1: processor.SwitchToWarrior(); break; case 2: processor.SwitchToMagic(); break; } } public void Dispose() { m_Processor.Dispose(); m_Processor = null; jobModels.Clear(); if (!AssetSource.mobFromEditor) { AssetBundleUtility.Instance.UnloadAssetBundle("mob/createrole", true, false); } } public void LoadModel(int job, Action<bool, UnityEngine.Object> _callBack) { if (jobModels.ContainsKey(job)) { if (_callBack != null) { _callBack(true, jobModels[job]); } return; } Action<bool, UnityEngine.Object> assetCallBack = (bool _ok, UnityEngine.Object _asset) => { GameObject instance = null; if (_ok) { instance = GameObject.Instantiate(_asset) as GameObject; if (instance != null) { jobModels[job] = instance; } } if (_callBack != null) { _callBack(_ok && instance != null, instance); } }; InstanceResourcesLoader.LoadCreateRole(job, assetCallBack); } public void ReleaseModel(int job) { if (jobModels.ContainsKey(job)) { jobModels[job].gameObject.SetActive(false); } } } System/CreateRole/CreateRoleManager.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 0c3b8f02b7ef2f74aa676f88444c8e6b timeCreated: 1554861276 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CreateRole/CreateRoleProcessor.cs
New file @@ -0,0 +1,90 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using Snxxz.UI; public class CreateRoleProcessor : MonoBehaviour { [SerializeField] CreateRoleBehaviour m_Warrior; [SerializeField] CreateRoleBehaviour m_Magic; [SerializeField] CameraParams m_CameraParams; Animator cameraAnimator; Camera createRoleCamera; public void LoadNecessaryResources() { if (cameraAnimator == null || createRoleCamera == null) { var prefab = SceneLoader.LoadCreateRole(m_CameraParams.prefabName); var instance = GameObject.Instantiate(prefab); cameraAnimator = instance.GetComponent<Animator>(); createRoleCamera = instance.GetComponentInChildren<Camera>(true); } } public void DoEnterShow() { WindowCenter.Instance.Close<CreateRoleWin>(); cameraAnimator.Play(m_CameraParams.enterShow); m_Warrior.gameObject.SetActive(true); m_Warrior.DoEnterShow(); } public void SwitchToWarrior() { WindowCenter.Instance.Close<CreateRoleWin>(); cameraAnimator.Play(m_CameraParams.magicToWarrior); m_Magic.ReleaseEffects(); m_Warrior.ReleaseEffects(); StopCoroutine("Co_SwitchToWarrior"); StartCoroutine("Co_SwitchToWarrior"); } public void SwitchToMagic() { WindowCenter.Instance.Close<CreateRoleWin>(); cameraAnimator.Play(m_CameraParams.warriorToMagic); m_Magic.ReleaseEffects(); m_Warrior.ReleaseEffects(); StopCoroutine("Co_SwitchToMagic"); StartCoroutine("Co_SwitchToMagic"); } IEnumerator Co_SwitchToWarrior() { m_Warrior.gameObject.SetActive(true); yield return WaitingForSecondConst.WaitMS1000; m_Magic.gameObject.SetActive(false); m_Warrior.DoRoutineShow(); } IEnumerator Co_SwitchToMagic() { yield return WaitingForSecondConst.WaitMS1000; m_Warrior.gameObject.SetActive(false); m_Magic.gameObject.SetActive(true); m_Magic.DoRoutineShow(); } public void Dispose() { m_Warrior.Dispose(); m_Magic.Dispose(); } [System.Serializable] public struct CameraParams { public string prefabName; public string enterShow; public string warriorToMagic; public string magicToWarrior; } } System/CreateRole/CreateRoleProcessor.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 2ae1317e6fb06ee449130819c45f90c5 timeCreated: 1554864340 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/CreateRole/CreateRoleTimeLine.cs
New file @@ -0,0 +1,113 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using System; public class CreateRoleTimeLine { public bool busying { get; private set; } Action onComplete; List<Node> nodes = new List<Node>(); LogicUpdate update; public CreateRoleTimeLine() { update = new LogicUpdate(); update.Start(OnUpdate); } public void AddNone(float time, Action task) { nodes.Add(new Node() { time = Time.time + time, task = task }); } public void Begin() { busying = true; } public void Stop() { Reset(); busying = false; } public void OnComplete(Action onComplete) { this.onComplete = onComplete; } public void ClearNode() { nodes.Clear(); } public void Dispose() { ClearNode(); if (update != null) { update.Destroy(); } } private void Reset() { foreach (var node in nodes) { node.executed = false; } } private void OnUpdate() { var allExecuted = true; foreach (var node in nodes) { if (!node.executed) { if (Time.time >= node.time) { node.Execute(); } } else { allExecuted = false; } } if (allExecuted) { if (this.onComplete != null) { this.onComplete(); } busying = false; } } public class Node { public bool executed; public float time; public Action task; public void Execute() { executed = true; if (task != null) { task(); } } } } System/CreateRole/CreateRoleTimeLine.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 6faa6c8425ab0bc4ea46a56636ebef92 timeCreated: 1554954545 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Login/CreateRoleHeroShow.cs
File was deleted System/Login/CreateRoleWin.cs
@@ -3,38 +3,34 @@ // [ Date ]: Saturday, September 02, 2017 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using System.Text; using System.Text.RegularExpressions; using UnityEngine.Events; namespace Snxxz.UI { public class CreateRoleWin : Window { [SerializeField] Button qhBtn; [SerializeField] Image qhImg; [SerializeField] Button dsBtn; [SerializeField] Image dsImg; [SerializeField] Button jsBtn; [SerializeField] Image jsImg; [SerializeField] Button createBtn; [SerializeField] Button randomBtn; [SerializeField] Button backBtn; [SerializeField] InputField userNameInput; [SerializeField] Image m_DescImg; private int userJob = 0; CreateRoleHeroShow m_CreateRoleShow; [SerializeField] SelectRoleButton m_JobSelect1; [SerializeField] SelectRoleButton m_JobSelect2; LoginModel m_Model; LoginModel model { get { return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<LoginModel>()); } } [SerializeField] Button m_Create; [SerializeField] Button m_RandomName; [SerializeField] Button m_Back; [SerializeField] InputField m_NameInput; [SerializeField] Image m_Description; [SerializeField] PositionTween m_LeftPostionTween; [SerializeField] PositionTween m_RightPositionTween; [SerializeField] UIAlphaTween m_AlphaTween; LoginModel model { get { return ModelCenter.Instance.GetModel<LoginModel>(); } } string m_MarkName = string.Empty; #region Built-in protected override void BindController() { @@ -42,17 +38,16 @@ protected override void AddListeners() { qhBtn.onClick.AddListener(QhBtn); dsBtn.onClick.AddListener(DsBtn); jsBtn.onClick.AddListener(JsBtn); m_JobSelect1.SetListener(SelectJob1); m_JobSelect2.SetListener(SelectJob2); createBtn.onClick.AddListener(CreateBtn); randomBtn.onClick.AddListener(() => m_Back.SetListener(BackBtn); m_Create.SetListener(CreateRole); m_RandomName.SetListener(() => { ChangeUserName(true); var job = CreateRoleManager.Instance.selectedJob.value; ChangeUserName(job, true); }); backBtn.onClick.AddListener(BackBtn); } private void BackBtn() @@ -62,25 +57,13 @@ protected override void OnPreOpen() { DTC0309_tagPlayerLoginInfo.RoleChange += RoleChage; DTC0309_tagPlayerLoginInfo.RoleChange += OnCreateRoleSuccess; model.onCreateRole = true; } protected override void OnAfterOpen() { userJob = 1; int _rand = UnityEngine.Random.Range(0, 100); for (int i = 0; i < GeneralDefine.RandomJobs.Count; i++) { var _value = GeneralDefine.RandomJobs[i]; if (_value != 0 && _rand < _value) { userJob = i + 1; break; } } ChangeUserName(true); RoleShow(0.2f); } protected override void OnPreClose() @@ -89,105 +72,94 @@ protected override void OnAfterClose() { DTC0309_tagPlayerLoginInfo.RoleChange -= RoleChage; DTC0309_tagPlayerLoginInfo.RoleChange -= OnCreateRoleSuccess; model.onCreateRole = false; RemoveRoleModel(); } protected override void OnActived() { base.OnActived(); m_LeftPostionTween.Play(); m_RightPositionTween.Play(); m_AlphaTween.Play(); ChangeUserName(CreateRoleManager.Instance.selectedJob.value, true); DisplayDynamicInfo(true); } protected override void LateUpdate() { base.LateUpdate(); DisplayDynamicInfo(false); } #endregion private void JsBtn() private void DisplayDynamicInfo(bool force) { if (userJob == 3) if (force || CreateRoleManager.Instance.selectedJob.dirty) { ChangeUserName(true); var job = CreateRoleManager.Instance.selectedJob.Fetch(); m_JobSelect1.SetSelected(job == 1); m_JobSelect2.SetSelected(job == 2); var config = CreateRoleConfig.Get(job); m_Description.SetSprite(config.desc); } } private void SelectJob1() { if (CreateRoleManager.Instance.selectedJob.value == 1) { ChangeUserName(1, true); return; } userJob = 3; ChangeUserName(false); RoleShow(0f); ChangeUserName(1, false); CreateRoleManager.Instance.View(1); } private void DsBtn() private void SelectJob2() { if (userJob == 2) if (CreateRoleManager.Instance.selectedJob.value == 2) { ChangeUserName(true); ChangeUserName(2, true); return; } userJob = 2; ChangeUserName(false); RoleShow(0f); ChangeUserName(2, false); CreateRoleManager.Instance.View(2); } private void QhBtn() private void ChangeUserName(int job, bool force = true) { if (userJob == 1) { ChangeUserName(true); return; } userJob = 1; ChangeUserName(false); RoleShow(0f); } public void UpdateInfo() { CreateRoleConfig qhCfg = CreateRoleConfig.Get(1); CreateRoleConfig dsCfg = CreateRoleConfig.Get(2); CreateRoleConfig jsCfg = CreateRoleConfig.Get(3); CreateRoleConfig sltCfg = null; switch (userJob) { case 1: sltCfg = qhCfg; break; case 2: sltCfg = dsCfg; break; case 3: sltCfg = jsCfg; break; } qhBtn.image.SetSprite(userJob == 1 ? sltCfg.selectIcon : sltCfg.unselectIcon); dsBtn.image.SetSprite(userJob == 2 ? sltCfg.selectIcon : sltCfg.unselectIcon); jsBtn.image.SetSprite(userJob == 3 ? sltCfg.selectIcon : sltCfg.unselectIcon); qhImg.SetSprite(userJob == 1 ? "CreateRole_Job1_Select" : "CreateRole_Job1_UnSelect"); dsImg.SetSprite(userJob == 2 ? "CreateRole_Job2_Select" : "CreateRole_Job2_UnSelect"); jsImg.SetSprite(userJob == 3 ? "CreateRole_Job3_Select" : "CreateRole_Job3_UnSelect"); m_DescImg.SetSprite(sltCfg.desc); } private void ChangeUserName(bool _force = true) { if (!_force && !m_MarkName.Equals(userNameInput.text)) if (!force && !m_MarkName.Equals(m_NameInput.text)) { return; } var _name = RandomNameConfig.GetFirstName(userJob) + RandomNameConfig.GetSecondName(userJob); m_MarkName = _name; ChangeUserName(_name); var name = RandomNameConfig.GetFirstName(job) + RandomNameConfig.GetSecondName(job); m_MarkName = name; m_NameInput.text = name; } private void ChangeUserName(string _name) { userNameInput.text = _name; } private void CreateBtn() private void CreateRole() { if (GameNetSystem.Instance.netState == GameNetSystem.NetState.Connected) { return; } if (userNameInput.text.Equals(string.Empty)) if (m_NameInput.text.Equals(string.Empty)) { ServerTipDetails.DisplayNormalTip(Language.Get("CreateRole_NameNull")); return; } int error = 0; if (!UIHelper.SatisfyNameLength(userNameInput.text, out error)) if (!UIHelper.SatisfyNameLength(m_NameInput.text, out error)) { switch (error) { @@ -200,22 +172,24 @@ } return; } if (DirtyWordConfig.IsDirtWord(userNameInput.text) || UIHelper.HasSpecialCharac(userNameInput.text) || DirtyNameConfig.IsDirtName(userNameInput.text)) if (DirtyWordConfig.IsDirtWord(m_NameInput.text) || UIHelper.HasSpecialCharac(m_NameInput.text) || DirtyNameConfig.IsDirtName(m_NameInput.text)) { ServerTipDetails.DisplayNormalTip(Language.Get("L1007")); return; } if (Application.internetReachability == NetworkReachability.NotReachable) { ServerTipDetails.DisplayNormalTip(Language.Get("L1116")); return; } LanguageVerify.Instance.VerifyPlayerName(userNameInput.text, 0, string.Empty, 0, 0, (bool ok, string name) => LanguageVerify.Instance.VerifyPlayerName(m_NameInput.text, 0, string.Empty, 0, 0, (bool ok, string name) => { C0105_tagCCreateRole createRole = new C0105_tagCCreateRole();//实例化C0105_tagCCreateRole createRole.Job = (byte)userJob; createRole.Job = (byte)CreateRoleManager.Instance.selectedJob.value; createRole.Name = name; createRole.Sex = 1; createRole.Hair = 10002; @@ -225,52 +199,45 @@ createRole.PlayerType = 1; GameNetSystem.Instance.SendInfo(createRole);//发送创角包 }); //屏蔽职业特效预先加载逻,以减少不必要的内存损耗和获得更快的场景切换速度,资源压缩使用LZ4才行。 // AssetPreLoad.Instance.PreLoadJobEffect(userJob); } private void RoleChage() private void OnCreateRoleSuccess() { if (Application.internetReachability == NetworkReachability.NotReachable) { ServerTipDetails.DisplayNormalTip(Language.Get("L1116")); return; } C0108_tagCRoleLoginAsk tagCRoleLoginAsk = new C0108_tagCRoleLoginAsk(); var tagCRoleLoginAsk = new C0108_tagCRoleLoginAsk(); tagCRoleLoginAsk.Type = 2;//进入游戏 tagCRoleLoginAsk.ClientID = SDKUtility.Instance.RegistrationID; GameNetSystem.Instance.SendInfo(tagCRoleLoginAsk); NetLinkWin.Show(); } private void RoleShow(float _delay) [System.Serializable] public struct SelectRoleButton { StopCoroutine("DelayShowActor"); StartCoroutine("DelayShowActor", _delay); public int job; public Button select; public Image backGround; public Image icon; public void SetListener(UnityAction action) { select.SetListener(action); } IEnumerator DelayShowActor(float _delay) public void SetSelected(bool selected) { m_CreateRoleShow = GameObject.FindObjectOfType<CreateRoleHeroShow>(); UpdateInfo(); yield return new WaitForSeconds(_delay); RemoveRoleModel(); ShowRoleModel(); var config = CreateRoleConfig.Get(job); backGround.SetSprite(selected ? config.selectIcon : config.unselectIcon); icon.SetSprite(selected ? "CreateRole_Job1_Select" : "CreateRole_Job1_UnSelect"); } private void ShowRoleModel() { m_CreateRoleShow.CreateRoleShow(userJob); } private void RemoveRoleModel() { m_CreateRoleShow.Dispose(); } } } System/Login/SelectRoleWin.cs
@@ -6,22 +6,32 @@ using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class SelectRoleWin : Window { [SerializeField] Text nameText; [SerializeField] Text lvText; [SerializeField] Text m_PlayerName; [SerializeField] Text m_PlayerLevel; [SerializeField] Button beginBtn; [SerializeField] Image playerIcon; [SerializeField] Button backBtn; [SerializeField] Button m_Begin; [SerializeField] Image m_Description; [SerializeField] Button m_Back; CreateRoleHeroShow m_CreateRoleShow; SelectRoleProcessor m_SelectRoleProcessor; SelectRoleProcessor selectRoleProcessor { get { if (m_SelectRoleProcessor == null) { m_SelectRoleProcessor = GameObject.FindObjectOfType<SelectRoleProcessor>(); } return m_SelectRoleProcessor; } } LoginModel model { get { return ModelCenter.Instance.GetModel<LoginModel>(); } } @@ -32,8 +42,8 @@ protected override void AddListeners() { beginBtn.onClick.AddListener(BeginBtn); backBtn.onClick.AddListener(BackToLogin); m_Begin.onClick.AddListener(BeginBtn); m_Back.onClick.AddListener(BackToLogin); } private void BackToLogin() @@ -43,8 +53,6 @@ protected override void OnPreOpen() { m_CreateRoleShow = GameObject.FindObjectOfType<CreateRoleHeroShow>(); InitInfo(); } @@ -58,35 +66,31 @@ protected override void OnAfterClose() { RemoveRoleModel(); selectRoleProcessor.Dispose(); } #endregion private void RemoveRoleModel() { m_CreateRoleShow.Dispose(); } private void BeginBtn() { if (GameNetSystem.Instance.netState != GameNetSystem.NetState.Connected) if (GameNetSystem.Instance.netState == GameNetSystem.NetState.Connected) { return; } if (Application.internetReachability == NetworkReachability.NotReachable) { ConfirmCancel.ShowPopConfirm( Language.Get("Mail101"), Language.Get("L1116"), () => { } Language.Get("L1116") ); NetLinkWin.Hide(); return; } else { LoadingWin.targetMapResId =2; WindowCenter.Instance.Open<LoadingWin>(); model.EnterWorld(2); } } } private void InitInfo() @@ -95,11 +99,13 @@ { return; } nameText.text = PlayerDatas.Instance.loginInfo.PlayerName.ToString();//玩家昵称 lvText.text = Language.Get("Z1024", PlayerDatas.Instance.loginInfo.LV);//玩家等级 CreateRoleConfig _cfg = CreateRoleConfig.Get(PlayerDatas.Instance.loginInfo.Job); playerIcon.SetSprite(_cfg.desc); m_CreateRoleShow.SelectRoleShow(); m_PlayerName.text = PlayerDatas.Instance.loginInfo.PlayerName.ToString();//玩家昵称 m_PlayerLevel.text = Language.Get("Z1024", PlayerDatas.Instance.loginInfo.LV);//玩家等级 var config = CreateRoleConfig.Get(PlayerDatas.Instance.loginInfo.Job); m_Description.SetSprite(config.desc); selectRoleProcessor.Show(PlayerDatas.Instance.loginInfo.Job); } } System/SelectRole.meta
New file @@ -0,0 +1,9 @@ fileFormatVersion: 2 guid: e131efedb12411f41931be24df713a3c folderAsset: yes timeCreated: 1554890866 licenseType: Pro DefaultImporter: userData: assetBundleName: assetBundleVariant: System/SelectRole/SelectRoleBehaviour.cs
New file @@ -0,0 +1,92 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using Snxxz.UI; public class SelectRoleBehaviour : MonoBehaviour { [SerializeField] Camera m_CreateRoleCamera; [SerializeField] CreateRoleHeroPlatform m_HeroPlatform; [SerializeField] ActorShadowCaster m_Shadow; UI3DShowHero playerModel = new UI3DShowHero(); public void Show() { Dispose(); var fashionClothes = 0; var fashionWeapon = 0; var fashionSecondary = 0; var clothesItemId = 0; var weaponItemId = 0; var wingsItemId = 0; var secondaryItemId = 0; var suitLevel = 0; var equipInfos = PlayerDatas.Instance.loginInfo.EquipInfo; for (int i = 0; i < equipInfos.Length; i++) { var equipInfo = equipInfos[i]; var itemConfig = ItemConfig.Get((int)equipInfo.ItemID); switch ((RoleEquipType)itemConfig.EquipPlace) { case RoleEquipType.FashionClothes: fashionClothes = (int)equipInfo.ItemID; break; case RoleEquipType.FashionWeapon: fashionWeapon = (int)equipInfo.ItemID; break; case RoleEquipType.FashionWeapon2: fashionSecondary = (int)equipInfo.ItemID; break; case RoleEquipType.Weapon: weaponItemId = (int)equipInfo.ItemID; break; case RoleEquipType.Clothes: clothesItemId = (int)equipInfo.ItemID; break; case RoleEquipType.Wing: wingsItemId = (int)equipInfo.ItemID; break; case RoleEquipType.Weapon2: secondaryItemId = (int)equipInfo.ItemID; break; } } var data = new UI3DPlayerExhibitionData() { job = PlayerDatas.Instance.loginInfo.Job, fashionClothesId = fashionClothes, clothesId = clothesItemId, suitLevel = suitLevel, fashionWeaponId = fashionWeapon, weaponId = weaponItemId, wingsId = wingsItemId, fashionSecondaryId = fashionSecondary, secondaryId = secondaryItemId, }; m_CreateRoleCamera.gameObject.SetActive(true); var model = playerModel.Show(data, m_HeroPlatform.transform); playerModel.StandUp(); m_Shadow.Cast(model.transform); } public void Dispose() { playerModel.Dispose(); } private void OnEnable() { } private void OnDestroy() { StopAllCoroutines(); } } System/SelectRole/SelectRoleBehaviour.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 215e4bd908ee7314984e023ff5b3967a timeCreated: 1554946916 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/SelectRole/SelectRoleProcessor.cs
New file @@ -0,0 +1,30 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using Snxxz.UI; public class SelectRoleProcessor : MonoBehaviour { [SerializeField] SelectRoleBehaviour m_Job1; [SerializeField] SelectRoleBehaviour m_Job2; public void Show(int job) { switch (job) { case 1: m_Job1.Show(); break; case 2: m_Job2.Show(); break; } } public void Dispose() { m_Job1.Dispose(); m_Job2.Dispose(); } } System/SelectRole/SelectRoleProcessor.cs.meta
UI/Common/UI3DModelFactory.cs
@@ -1,67 +1,12 @@ using UnityEngine; using System.Collections.Generic; using System; public class UI3DModelFactory { static UI3DModelFactory() { GlobalTimeEvent.Instance.minuteEvent += OnPerMinute; } static Dictionary<int, GameObject> jobModels = new Dictionary<int, GameObject>(); public static void LoadCreateRole(int job, Action<bool, UnityEngine.Object> _callBack) { if (jobModels.ContainsKey(job)) { if (_callBack != null) { _callBack(true, jobModels[job]); } return; } Action<bool, UnityEngine.Object> assetCallBack = (bool _ok, UnityEngine.Object _asset) => { GameObject instance = null; if (_ok) { instance = GameObject.Instantiate(_asset) as GameObject; if (instance != null) { jobModels[job] = instance; } } if (_callBack != null) { _callBack(_ok && instance != null, instance); } }; InstanceResourcesLoader.LoadCreateRole(job, assetCallBack); } public static void ReleaseCreateRole(int job) { if (jobModels.ContainsKey(job)) { jobModels[job].gameObject.SetActive(false); } } public static void ClearCreateRole() { jobModels.Clear(); if (!AssetSource.mobFromEditor) { AssetBundleUtility.Instance.UnloadAssetBundle("mob/createrole", true, false); } } public static GameObject LoadUINPC(int id)