| | |
| | | public virtual void Export(BinaryWriter bw) |
| | | { |
| | | bw.Write((byte)type); |
| | | Debug.LogFormat("type: {0}", type); |
| | | bw.Write(id); |
| | | Debug.LogFormat("id: {0}", id); |
| | | } |
| | | #endif |
| | | } |
| | |
| | | { |
| | | base.Export(bw); |
| | | bw.Write(sceneObjList.Count); |
| | | Debug.LogFormat("sceneObjList.Count: {0}", sceneObjList.Count); |
| | | foreach (var _sceneObject in sceneObjList) |
| | | { |
| | | _sceneObject.Export(bw); |
| | |
| | | { |
| | | string _resName = br.ReadString(); |
| | | var _sceneData = CreateSceneObject(_resName); |
| | | _sceneData.transform.SetParent(transform); |
| | | _sceneData.Load(br); |
| | | _sceneData.transform.SetParent(transform); |
| | | |
| | | sceneObjList.Add(_sceneData); |
| | | } |
| | |
| | | public void Export(BinaryWriter bw) |
| | | { |
| | | bw.Write(id); |
| | | Debug.LogFormat("id: {0}", id); |
| | | bw.Write(triggerList.Count); |
| | | Debug.LogFormat("triggerList.Count: {0}", triggerList.Count); |
| | | foreach (var _trigger in triggerList) |
| | | { |
| | | _trigger.Export(bw); |
| | | } |
| | | bw.Write(eventList.Count); |
| | | Debug.LogFormat("eventList.Count: {0}", eventList.Count); |
| | | foreach (var _event in eventList) |
| | | { |
| | | _event.Export(bw); |
| | | } |
| | | bw.Write(transferList.Count); |
| | | Debug.LogFormat("transferList.Count: {0}", transferList.Count); |
| | | foreach (var _transfer in transferList) |
| | | { |
| | | _transfer.Export(bw); |
| | |
| | | { |
| | | public class Bhv_MapTrigger : MonoBehaviour |
| | | { |
| | | public enum E_TriggerType |
| | | { |
| | | Trigger, |
| | | EnterStage |
| | | } |
| | | |
| | | [HideInInspector] |
| | | public int id; |
| | | [HideInInspector] |
| | | public E_TriggerType triggerType = E_TriggerType.Trigger; |
| | | public MapTrigger.E_TriggerType triggerType = MapTrigger.E_TriggerType.Trigger; |
| | | [HideInInspector] |
| | | public Evt.E_EventType type = Evt.E_EventType.Enemy; |
| | | [HideInInspector] |
| | |
| | | public void Load(BinaryReader br) |
| | | { |
| | | id = br.ReadInt32(); |
| | | triggerType = (E_TriggerType)br.ReadByte(); |
| | | triggerType = (MapTrigger.E_TriggerType)br.ReadByte(); |
| | | type = (Evt.E_EventType)br.ReadByte(); |
| | | prevID = br.ReadInt32(); |
| | | float _pX = br.ReadSingle(); |
| | |
| | | EditorGUILayout.LabelField("前置触发器", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(80)); |
| | | prevID = EditorGUILayout.IntField(prevID, guiSkin.textField, GUILayout.Height(20)); |
| | | EditorGUILayout.LabelField("触发器类型", guiSkin.customStyles[0], GUILayout.Height(22), GUILayout.Width(80)); |
| | | triggerType = (E_TriggerType)EditorGUILayout.EnumPopup(triggerType, guiSkin.customStyles[1], GUILayout.Height(20), GUILayout.Width(100)); |
| | | triggerType = (MapTrigger.E_TriggerType)EditorGUILayout.EnumPopup(triggerType, guiSkin.customStyles[1], GUILayout.Height(20), GUILayout.Width(100)); |
| | | EditorGUILayout.EndHorizontal(); |
| | | |
| | | EditorGUILayout.BeginVertical(guiSkin.customStyles[1]); |
| | |
| | | public void Save(BinaryWriter bw) |
| | | { |
| | | bw.Write(resName); |
| | | Debug.LogFormat("resName: {0}", resName); |
| | | bw.Write(isObstacle); |
| | | Debug.LogFormat("isObstacle: {0}", isObstacle); |
| | | bw.Write((float)System.Math.Round(transform.position.x, 2)); |
| | | Debug.LogFormat("x: {0}", (float)System.Math.Round(transform.position.x, 2)); |
| | | bw.Write((float)System.Math.Round(transform.position.y, 2)); |
| | | Debug.LogFormat("y: {0}", (float)System.Math.Round(transform.position.y, 2)); |
| | | bw.Write((float)System.Math.Round(transform.position.z, 2)); |
| | | Debug.LogFormat("z: {0}", (float)System.Math.Round(transform.position.z, 2)); |
| | | bw.Write((float)System.Math.Round(transform.eulerAngles.y, 2)); |
| | | Debug.LogFormat("angle: {0}", transform.eulerAngles.y); |
| | | } |
| | | |
| | | public void Load(BinaryReader br) |
| | |
| | | using System.IO; |
| | | using UnityEngine; |
| | | |
| | | namespace H2Engine |
| | | { |
| | |
| | | using System.IO; |
| | | using UnityEngine; |
| | | |
| | | namespace H2Engine |
| | | { |
| New file |
| | |
| | | using System.IO; |
| | | using UnityEngine; |
| | | |
| | | namespace H2Engine |
| | | { |
| | | public class Evt_RefreshSceneObject : Evt |
| | | { |
| | | public SceneObjectData[] sceneObjects; |
| | | |
| | | public override void Load(BinaryReader br) |
| | | { |
| | | base.Load(br); |
| | | int _count = br.ReadInt32(); |
| | | sceneObjects = new SceneObjectData[_count]; |
| | | for (int i = 0; i < _count; ++i) |
| | | { |
| | | sceneObjects[i] = new SceneObjectData(); |
| | | sceneObjects[i].Load(br); |
| | | } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f8ba8ee83584f0d459528aa89f8a405d |
| | | timeCreated: 1548142374 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using System.IO; |
| | | using UnityEngine; |
| | | |
| | | public class SceneObjectData |
| | | { |
| | | public string resName; |
| | | public bool isObstacle = false; |
| | | public Vector3 position; |
| | | public Vector3 eulerAngles; |
| | | |
| | | public void Load(BinaryReader br) |
| | | { |
| | | resName = br.ReadString(); |
| | | isObstacle = br.ReadBoolean(); |
| | | float _x = br.ReadSingle(); |
| | | float _y = br.ReadSingle(); |
| | | float _z = br.ReadSingle(); |
| | | float _eulerAngle = br.ReadSingle(); |
| | | position = new Vector3(_x, _y, _z); |
| | | eulerAngles = new Vector3(0, _eulerAngle, 0); |
| | | } |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: a361d7d0c92eed0439c8c475e611243b |
| | | timeCreated: 1548142387 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | if (AssetSource.refdataFromEditor) |
| | | { |
| | | #if UNITY_EDITOR |
| | | _path = ResourcesPath.ResourcesOutPath + "Refdata/ScriptableObject/MapData/" + mapID + ".gd"; |
| | | |
| | | _path = StringUtility.Contact(ResourcesPath.CONFIG_FODLER, |
| | | "/", |
| | | MapEditorData_Suffix, |
| | | mapID, |
| | | ".bytes"); |
| | | #endif |
| | | } |
| | | else |
| | | { |
| | | _path = AssetVersionUtility.GetAssetFilePath(StringUtility.Contact("mapdata/", mapID, ".gd")); |
| | | _path = AssetVersionUtility.GetAssetFilePath(StringUtility.Contact("config/", MapEditorData_Suffix, mapID, ".bytes")); |
| | | } |
| | | MapData _mapData = null; |
| | | if (File.Exists(_path)) |
| | |
| | | { |
| | | _event = new Evt_RefreshMonster(); |
| | | } |
| | | else if (_type == Evt.E_EventType.SceneObject) |
| | | { |
| | | _event = new Evt_RefreshSceneObject(); |
| | | } |
| | | if (_event != null) |
| | | { |
| | | _event.type = _type; |
| | | _event.Load(br); |
| | | eventDict[_event.id] = _event; |
| | | } |
| | |
| | | [System.Serializable] |
| | | public class MapTrigger |
| | | { |
| | | public enum E_TriggerType |
| | | { |
| | | Trigger, |
| | | EnterStage |
| | | } |
| | | |
| | | public Evt.E_EventType type; |
| | | public E_TriggerType triggerType; |
| | | public int prevID; |
| | | public int id; |
| | | public int[] evevntIDs; |
| | |
| | | public void Load(BinaryReader br) |
| | | { |
| | | id = br.ReadInt32(); |
| | | triggerType = (E_TriggerType)br.ReadByte(); |
| | | type = (Evt.E_EventType)br.ReadByte(); |
| | | prevID = br.ReadInt32(); |
| | | float _pX = br.ReadSingle(); |
| | |
| | | { |
| | | Export(); |
| | | } |
| | | if (GUILayout.Button("导入", gUISkin.button, GUILayout.Width(60), GUILayout.Height(22))) |
| | | { |
| | | MapData.LoadFormFile(10010); |
| | | } |
| | | EditorGUILayout.EndHorizontal(); |
| | | |
| | | /// -------------------------------------------------------------------------------- |
| | |
| | | using (var _binaryWriter = new BinaryWriter(_fileStream)) |
| | | { |
| | | _mapData.Save(_binaryWriter); |
| | | EditorPrefs.SetString(LS_KEY_SAVEPATH, Directory.GetParent(_path).FullName); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | var _mapData = target as Bhv_MapData; |
| | | string _defaultPath = EditorPrefs.GetString(LS_KEY_SAVEPATH, System.Environment.CurrentDirectory); |
| | | string _path = EditorUtility.SaveFilePanel("导出数据", _defaultPath, "map_" + _mapData.id, "bytes"); |
| | | string _path = EditorUtility.SaveFilePanel("导出数据", _defaultPath, MapData.MapEditorData_Suffix + _mapData.id, "bytes"); |
| | | if (string.IsNullOrEmpty(_path)) |
| | | { |
| | | return; |
| | |
| | | { |
| | | using (var _binaryWriter = new BinaryWriter(_fileStream)) |
| | | { |
| | | _mapData.Save(_binaryWriter); |
| | | _mapData.Export(_binaryWriter); |
| | | } |
| | | } |
| | | } |
| | |
| | | using (var _binaryReader = new BinaryReader(_fileStream)) |
| | | { |
| | | _mapData.Load(_binaryReader); |
| | | EditorPrefs.SetString(LS_KEY_SAVEPATH, Directory.GetParent(_path).FullName); |
| | | } |
| | | } |
| | | } |
| | |
| | | var vNetData = vNetPack as H0403_tagPlayerLoginLoadOK;
|
| | | GameNetSystem.Instance.netState = GameNetSystem.NetState.Connected;
|
| | | finishedLogin = true;
|
| | | GA_Hero.s_MapSwitching = false;
|
| | |
|
| | | NetLinkWin.Hide();
|
| | |
|
| | |
| | |
|
| | | MapTransferUtility.Instance.CheckMap(PlayerDatas.Instance.baseData.MapID);
|
| | |
|
| | | GA_Hero.s_MapSwitching = false;
|
| | | if (MapTransferUtility.Instance.MapTransferDoType == MapTransferUtility.E_MapTransferDoType.Npc)
|
| | | {
|
| | | MapTransferUtility.Instance.MoveToNPC(MapTransferUtility.Instance.NpcID);
|
| | |
| | | PlayerDatas.Instance.hero.EnterArea((int)MapArea.E_Type.Boss);
|
| | | }
|
| | | }
|
| | |
|
| | | IEnumerator DelayNpcHandler(int npcID)
|
| | | {
|
| | | yield return WaitingForSecondConst.WaitMS200;
|
| | |
|
| | | GA_Hero.s_MapSwitching = false;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
| | | return _gameObject;
|
| | | }
|
| | |
|
| | | private static GameObject LoadModelPrefab(string _suffix, string name, bool _ui)
|
| | | public static GameObject LoadModelPrefab(string _suffix, string name, bool _ui)
|
| | | {
|
| | | var prefab = LoadModelPrefab(_suffix, _ui ? name + "_UI" : name);
|
| | | if (prefab == null)
|
| | |
| | | HideSecondaryEffect();
|
| | | HideHorseEffect();
|
| | |
|
| | | m_EquipDict.Clear();
|
| | |
|
| | | if (m_HorseModel)
|
| | | {
|
| | | HorseConfig _horseConfig = Config.Instance.Get<HorseConfig>((int)HorseID);
|
| | | _prefab = InstanceResourcesLoader.LoadModelRes(_horseConfig.Model);
|
| | | GameObjectPoolManager.Instance.ReleaseGameObject(_prefab, m_HorseModel);
|
| | | m_HorseModel = null;
|
| | |
|
| | | if (m_HorseAnimator)
|
| | | {
|
| | | m_HorseAnimator.SetInteger(GAStaticDefine.Param_Action, 0);
|
| | | m_HorseAnimator.enabled = false;
|
| | | m_HorseAnimator = null;
|
| | | }
|
| | |
|
| | | m_HorseBindNode = null;
|
| | | }
|
| | |
|
| | | if (null != m_Guard)
|
| | | {
|
| | | m_Guard.UnInit();
|
| | | m_Guard = null;
|
| | | }
|
| | |
|
| | | int _resID = 0;
|
| | | ItemConfig _itemConfig = null;
|
| | |
|
| | | if (m_ClothesModel)
|
| | | {
|
| | | SFXController[] _ctrls = m_ClothesModel.GetComponentsInChildren<SFXController>();
|
| | | if (_ctrls != null && _ctrls.Length > 0)
|
| | | {
|
| | | for (int i = 0; i < _ctrls.Length; ++i)
|
| | | {
|
| | | SFXPlayUtility.Instance.Release(_ctrls[i]);
|
| | | }
|
| | | }
|
| | |
|
| | | _resID = JobSetup.BaseEquip[0];
|
| | | if (ClothesItemID != 0)
|
| | | {
|
| | | _itemConfig = Config.Instance.Get<ItemConfig>((int)ClothesItemID);
|
| | | _resID = _itemConfig.ChangeOrd;
|
| | | }
|
| | |
|
| | | if (TryRelease(_resID, m_ClothesModel))
|
| | | {
|
| | | m_ClothesModel = null;
|
| | |
|
| | | if (m_ClothesAnimator)
|
| | | {
|
| | | m_ClothesAnimator.SetInteger(GAStaticDefine.Param_MoveState, (int)E_MovingState.Normal);
|
| | | m_ClothesAnimator.enabled = false;
|
| | | m_ClothesAnimator = null;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | m_EquipDict.Clear();
|
| | | if (m_WeaponModel)
|
| | | {
|
| | | _resID = JobSetup.BaseEquip[1];
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | if (m_HorseModel)
|
| | | {
|
| | | HorseConfig _horseConfig = Config.Instance.Get<HorseConfig>((int)HorseID);
|
| | | _prefab = InstanceResourcesLoader.LoadModelRes(_horseConfig.Model);
|
| | | GameObjectPoolManager.Instance.ReleaseGameObject(_prefab, m_HorseModel);
|
| | | m_HorseModel = null;
|
| | |
|
| | | if (m_HorseAnimator)
|
| | | {
|
| | | m_HorseAnimator.SetInteger(GAStaticDefine.Param_Action, 0);
|
| | | m_HorseAnimator.enabled = false;
|
| | | m_HorseAnimator = null;
|
| | | }
|
| | |
|
| | | m_HorseBindNode = null;
|
| | | }
|
| | |
|
| | | if (null != m_Guard)
|
| | | {
|
| | | m_Guard.UnInit();
|
| | | m_Guard = null;
|
| | | }
|
| | |
|
| | | if (m_ClothesModel)
|
| | | {
|
| | | SFXController[] _ctrls = m_ClothesModel.GetComponentsInChildren<SFXController>();
|
| | | if (_ctrls != null && _ctrls.Length > 0)
|
| | | {
|
| | | for (int i = 0; i < _ctrls.Length; ++i)
|
| | | {
|
| | | SFXPlayUtility.Instance.Release(_ctrls[i]);
|
| | | }
|
| | | }
|
| | |
|
| | | _resID = JobSetup.BaseEquip[0];
|
| | | if (ClothesItemID != 0)
|
| | | {
|
| | | _itemConfig = Config.Instance.Get<ItemConfig>((int)ClothesItemID);
|
| | | _resID = _itemConfig.ChangeOrd;
|
| | | }
|
| | |
|
| | | if (TryRelease(_resID, m_ClothesModel))
|
| | | {
|
| | | m_ClothesModel = null;
|
| | |
|
| | | if (m_ClothesAnimator)
|
| | | {
|
| | | m_ClothesAnimator.SetInteger(GAStaticDefine.Param_MoveState, (int)E_MovingState.Normal);
|
| | | m_ClothesAnimator.enabled = false;
|
| | | m_ClothesAnimator = null;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (m_SMRenderer)
|
| | | {
|
| | | MaterialLoader.Release(m_SMRenderer.material);
|
| | |
| | | } |
| | | |
| | | if (Type == (int)E_ModelResType.Horse |
| | | || Type == (int)E_ModelResType.Pet) |
| | | || Type == (int)E_ModelResType.Pet |
| | | || Type == (int)E_ModelResType.Weapon |
| | | || Type == (int)E_ModelResType.Secondary) |
| | | { |
| | | if (!string.IsNullOrEmpty(boneNameList)) |
| | | if (!string.IsNullOrEmpty(EffFileName)) |
| | | { |
| | | var _bones = boneNameList.Split('|'); |
| | | var _effects = EffFileName.Split('|'); |
| | | |
| | | if (_bones.Length != _effects.Length) |
| | | { |
| | | Debug.LogWarningFormat("{0} 绑定骨骼的数量和特效的数量无法对应 {1} != {2}", ID, _bones.Length, _effects.Length); |
| | | Debug.LogWarningFormat("{0} ��������������Ч����������Ӧ {1} != {2}", ID, _bones.Length, _effects.Length); |
| | | } |
| | | |
| | | var _boneList = new List<string>(); |
| | |
| | | } |
| | | _effectList.Add(int.Parse(_effects[i])); |
| | | |
| | | // Debug.LogFormat("设置特效配置: {0} => {1}", _bones[i], _dict[_bones[i]]); |
| | | // Debug.LogFormat("����������: {0} => {1}", _bones[i], _dict[_bones[i]]); |
| | | } |
| | | |
| | | effectBoneDict[ResourcesName] = _boneList; |
| | |
| | | { |
| | | if (id <= 0) |
| | | { |
| | | id = 4100;// 默认值 |
| | | id = 4100;// Ĭ��ֵ |
| | | } |
| | | |
| | | var _config = Config.Instance.Get<ModelResConfig>(id); |
| | | if (_config == null) |
| | | { |
| | | return 7000;// 默认值 |
| | | return 7000;// Ĭ��ֵ |
| | | } |
| | | |
| | | return _config.RelatedPartID; |
| | |
| | | {
|
| | | public static Dictionary<MapArea.E_Type, List<MapArea>> s_MapAreaDict;
|
| | | public static MapType CurrentMapType;
|
| | | private H2Engine.MapData mapData;
|
| | |
|
| | | public override void Initialize()
|
| | | {
|
| | |
| | | _hero.SkillMgr.ResetAllCD();
|
| | | }
|
| | |
|
| | | HandleMapData();
|
| | |
|
| | | GA_Hero.s_MapSwitching = false;
|
| | | }
|
| | |
|
| | | public override void UnInitialize()
|
| | | {
|
| | | base.UnInitialize();
|
| | |
|
| | | mapData = null;
|
| | |
|
| | | if (s_MapAreaDict != null)
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void HandleMapData()
|
| | | {
|
| | | mapData = H2Engine.MapData.LoadFormFile(PlayerDatas.Instance.baseData.MapID);
|
| | | if (mapData == null)
|
| | | {
|
| | | Debug.LogFormat("------------------ 数据是空的");
|
| | | return;
|
| | | }
|
| | | // 目前版本只处理刷场景物件
|
| | | foreach (var _trigger in mapData.triggers)
|
| | | {
|
| | | if (_trigger.triggerType != H2Engine.MapTrigger.E_TriggerType.EnterStage)
|
| | | {
|
| | | Debug.Log("_trigger.triggerType: " + _trigger.triggerType);
|
| | | continue;
|
| | | }
|
| | |
|
| | | foreach (var _id in _trigger.evevntIDs)
|
| | | {
|
| | | var _event = mapData.eventDict[_id];
|
| | | if (_event.type == H2Engine.Evt.E_EventType.SceneObject)
|
| | | {
|
| | | var _refreshSceneObject = _event as H2Engine.Evt_RefreshSceneObject;
|
| | | if (_refreshSceneObject != null)
|
| | | {
|
| | | foreach (var _sceneObjData in _refreshSceneObject.sceneObjects)
|
| | | {
|
| | | var _prefab = InstanceResourcesLoader.LoadModelPrefab(InstanceResourcesLoader.raceSuffix, _sceneObjData.resName, false);
|
| | | if (_prefab)
|
| | | {
|
| | | var _go = GameObject.Instantiate(_prefab);
|
| | | _go.transform.position = _sceneObjData.position;
|
| | | _go.transform.eulerAngles = _sceneObjData.eulerAngles;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void HandleAutoFight()
|
| | | {
|
| | | DungeonModel _dungeonModel = ModelCenter.Instance.GetModel<DungeonModel>();
|