using System; using System.Collections.Generic; using UnityEngine; using XUtliPoolLib; namespace XMainClient { internal class XInput : XSingleton { public bool Freezed { get { return XSingleton.singleton.Freezed && XSingleton.singleton.Freezed; } set { bool flag = XSingleton.singleton.bSpectator || value; bool flag2 = flag; if (flag2) { bool flag3 = this._freeze_count == 0; if (flag3) { XSingleton.singleton.Freezed = true; XSingleton.singleton.Freezed = true; XSingleton.singleton.Empty(); } this._freeze_count++; bool flag4 = XSingleton.singleton.CurrentStage is XConcreteStage; if (flag4) { XSingleton.singleton.AddLog("Freeze++: ", this._freeze_count.ToString(), null, null, null, null, XDebugColor.XDebug_None); } } else { this._freeze_count--; bool flag5 = this._freeze_count == 0; if (flag5) { XSingleton.singleton.Freezed = false; XSingleton.singleton.Freezed = false; } else { bool flag6 = this._freeze_count < 0; if (flag6) { this._freeze_count = 0; } } bool flag7 = XSingleton.singleton.CurrentStage is XConcreteStage; if (flag7) { XSingleton.singleton.AddLog("Freeze--: ", this._freeze_count.ToString(), null, null, null, null, XDebugColor.XDebug_None); } } } } public bool HasMove { get { return this._hasMove; } } public bool HasEnemy { get { return this._hasEnemy; } } public bool HasNpc { get { return this._hasNpc; } } public bool HasRole { get { return this._hasRole; } } public bool HasDummy { get { return this._hasDummy; } } public float LastMoveAt { get { return this._last_move_at; } } public float LastEntityAt { get { return this._last_entity_at; } } public XEntity LastEnemy { get { return this._last_enemy; } } public XEntity LastNpc { get { return this._last_npc; } set { this._last_npc = value; this._hasNpc = (this._last_npc != null); } } public XEntity LastRole { get { return this._last_role; } } public XEntity LastDummy { get { return this._last_dummy; } } public Vector3 LastMovePoint { get { return this._last_move_point; } } public Vector3 LastGroundPoint { get { return this._last_ground_point; } } public bool IsFxShield { get { return this._ally_fx_shield; } } public bool IsMyFxShield { get { return this._my_fx_shield; } } private GameObject _45hide = null; private XEntity _last_enemy = null; private XEntity _last_npc = null; private XEntity _last_role = null; private XEntity _last_dummy = null; private Vector3 _last_move_point = Vector3.zero; private Vector3 _last_ground_point = Vector3.zero; private float _last_move_at = 0f; private float _last_entity_at = 0f; private RaycastHit _hit; private int _freeze_count = 0; private bool _hasMove = false; private bool _hasEnemy = false; private bool _hasNpc = false; private bool _hasRole = false; private bool _hasDummy = false; private bool _ally_fx_shield = false; private bool _mob_shield = false; private bool _my_fx_shield = false; private XTableAsyncLoader _async_loader = null; private XOperationTable _reader = new XOperationTable(); public override bool Init() { bool flag = this._async_loader == null; if (flag) { this._async_loader = new XTableAsyncLoader(); this._async_loader.AddTask("Table/XOperation", this._reader, false); this._async_loader.Execute(null); } bool flag2 = !this._async_loader.IsDone; return !flag2; } public override void Uninit() { this._async_loader = null; } public void UnFreezed() { bool freezed = this.Freezed; if (freezed) { this._freeze_count = 1; this.Freezed = false; } } public void OnEnterScene() { this._45hide = null; this._freeze_count = 0; XSingleton.singleton.OnEnterScene(); XSingleton.singleton.OnEnterScene(); XSingleton.singleton.OnEnterScene(); this.UpdateShieldOperation(); this.UnFreezed(); } public void OnLeaveScene() { this._last_npc = null; } public void UpdateShieldOperation() { XOptionsDocument specificDocument = XDocuments.GetSpecificDocument(XOptionsDocument.uuID); bool flag = specificDocument != null; if (flag) { this._ally_fx_shield = (specificDocument.GetValue(XOptionsDefine.OD_Shield_Skill_Fx) != 0); this._mob_shield = (specificDocument.GetValue(XOptionsDefine.OD_Shield_Summon) != 0); this._my_fx_shield = (specificDocument.GetValue(XOptionsDefine.OD_Shield_My_Skill_Fx) != 0); bool flag2 = XSingleton.singleton.Player != null; if (flag2) { List ally = XSingleton.singleton.GetAlly(XSingleton.singleton.Player); for (int i = 0; i < ally.Count; i++) { bool flag3 = ally[i].Skill != null && ally[i].Skill.SkillMobs != null; if (flag3) { for (int j = 0; j < ally[i].Skill.SkillMobs.Count; j++) { ally[i].Skill.SkillMobs[j].MobShield = this.MobShield(ally[i].Skill.SkillMobs[j]); } } } } } } public void UpdateDefaultCameraOperationByScene() { SceneTable.RowData sceneData = XSingleton.singleton.GetSceneData(XSingleton.singleton.SceneID); XOperationTable.RowData rowData = null; XOperationMode operationMode = XSingleton.singleton.OperationMode; if (operationMode != XOperationMode.X25D) { if (operationMode - XOperationMode.X3D <= 1) { rowData = this._reader.GetByID((int)sceneData.OperationSettings[0]); } } else { rowData = this._reader.GetByID((int)sceneData.OperationSettings[1]); } bool flag = rowData != null; if (flag) { XSingleton.singleton.CameraAngle = rowData.Angle; XSingleton.singleton.CameraDistance = rowData.Distance; XSingleton.singleton.AllowVertical = rowData.Vertical; XSingleton.singleton.AllowHorizontal = rowData.Horizontal; XSingleton.singleton.MaxVertical = rowData.MaxV; XSingleton.singleton.MinVertical = rowData.MinV; XSingleton.singleton.OffSolo = rowData.OffSolo; } } public bool FxShield(XEntity e) { return (this._ally_fx_shield && e != null && !e.IsPlayer && XSingleton.singleton.IsAlly(e)) || (this._my_fx_shield && e != null && e.IsPlayer); } public bool MobShield(XEntity e) { return this._mob_shield && e != null && e.MobbedBy != null && !e.MobbedBy.IsPlayer && e.MobShieldable && XSingleton.singleton.IsAlly(e); } public bool UpdateOperationMode() { bool isPlaying = XSingleton.singleton.IsPlaying; bool result; if (isPlaying) { XSingleton.singleton.AddErrorLog("Cannot change operation mode during cut-scene playing!", null, null, null, null, null); result = false; } else { bool flag = XSingleton.singleton.CurrentStage is XConcreteStage; if (flag) { this.InnerOperationModeUpdate(); result = true; } else { result = false; } } return result; } private void InnerOperationModeUpdate() { XSingleton.singleton.Cancel(); XSingleton.singleton.Cancel(); XOperationMode operationMode = XSingleton.singleton.OperationMode; if (operationMode != XOperationMode.X25D) { if (operationMode - XOperationMode.X3D <= 1) { bool flag = this._45hide == null; if (flag) { this._45hide = GameObject.Find("Scene/45hide"); } bool flag2 = this._45hide != null && !this._45hide.activeSelf; if (flag2) { this._45hide.SetActive(true); } } } else { bool flag3 = this._45hide == null; if (flag3) { this._45hide = GameObject.Find("Scene/45hide"); } bool flag4 = this._45hide != null && this._45hide.activeSelf; if (flag4) { this._45hide.SetActive(false); } } XSingleton.singleton.GameCamera.SetSightType(); } private XEntity HitOnEnemy() { return null; } private XEntity HitOnRole() { bool oneUpTouch = XSingleton.singleton.OneUpTouch; if (oneUpTouch) { bool flag = XSingleton.singleton.CurrentStage.Stage == EXStage.Hall && XSingleton.singleton.GameCamera.UnityCamera != null; if (flag) { Ray ray = XSingleton.singleton.GameCamera.UnityCamera.ScreenPointToRay(XSingleton.singleton.TouchPosition); int num = 1 << LayerMask.NameToLayer("Role"); bool flag2 = Physics.SphereCast(ray, 0.1f, out this._hit, float.PositiveInfinity, num); if (flag2) { string s = this._hit.collider.gameObject.name.StartsWith("mount_") ? this._hit.collider.gameObject.name.Substring(6) : this._hit.collider.gameObject.name; ulong id = 0UL; bool flag3 = ulong.TryParse(s, out id); if (flag3) { XEntity entity = XSingleton.singleton.GetEntity(id); return (entity != null && entity.IsRole && !entity.IsPlayer) ? entity : null; } return null; } } } return null; } private XEntity HitOnDummy() { bool oneUpTouch = XSingleton.singleton.OneUpTouch; if (oneUpTouch) { bool flag = XSingleton.singleton.CurrentStage.Stage == EXStage.Hall && XSingleton.singleton.GameCamera.UnityCamera != null; if (flag) { Ray ray = XSingleton.singleton.GameCamera.UnityCamera.ScreenPointToRay(XSingleton.singleton.TouchPosition); int num = 1 << LayerMask.NameToLayer("Dummy"); bool flag2 = Physics.SphereCast(ray, 0.1f, out this._hit, float.PositiveInfinity, num); if (flag2) { ulong id = 0UL; bool flag3 = ulong.TryParse(this._hit.collider.gameObject.name, out id); if (flag3) { XEntity entityConsiderDeath = XSingleton.singleton.GetEntityConsiderDeath(id); return (entityConsiderDeath != null && entityConsiderDeath.IsDummy) ? entityConsiderDeath : null; } return null; } } } return null; } private XEntity HitOnNpc() { bool oneUpTouch = XSingleton.singleton.OneUpTouch; if (oneUpTouch) { bool flag = XSingleton.singleton.CurrentStage.Stage == EXStage.Hall && XSingleton.singleton.GameCamera.UnityCamera != null; if (flag) { Ray ray = XSingleton.singleton.GameCamera.UnityCamera.ScreenPointToRay(XSingleton.singleton.TouchPosition); int num = 1 << LayerMask.NameToLayer("Npc"); bool flag2 = Physics.SphereCast(ray, 0.1f, out this._hit, float.PositiveInfinity, num); if (flag2) { ulong id = 0UL; bool flag3 = ulong.TryParse(this._hit.collider.gameObject.name, out id); if (flag3) { XEntity entity = XSingleton.singleton.GetEntity(id); return (entity != null && entity.IsNpc) ? entity : null; } return null; } } } return null; } private Vector3 HitOnGround() { return Vector3.zero; } public void Update() { Vector3 vector = Vector3.zero; this._hasMove = false; this._hasEnemy = false; this._hasNpc = false; this._hasRole = false; this._hasDummy = false; XSingleton.singleton.Update(); bool gestured = XSingleton.singleton.Gestured; if (gestured) { XEntity xentity = this.HitOnEnemy(); this._hasEnemy = (xentity != null); XEntity xentity2 = this.HitOnNpc(); this._hasNpc = (xentity2 != null); bool flag = !this._hasEnemy && !this._hasNpc; if (flag) { xentity2 = this.HitOnRole(); this._hasRole = (xentity2 != null); this._last_role = (this._hasRole ? xentity2 : null); bool flag2 = !this._hasRole; if (flag2) { xentity2 = this.HitOnDummy(); this._hasDummy = (xentity2 != null); this._last_dummy = (this._hasDummy ? xentity2 : null); bool flag3 = !this._hasDummy; if (flag3) { vector = this.HitOnGround(); bool flag4 = vector != Vector3.zero; bool oneTouch = XSingleton.singleton.OneTouch; if (oneTouch) { this._hasMove = flag4; bool hasMove = this._hasMove; if (hasMove) { this._last_move_point = vector; this._last_move_at = Time.time; } } bool flag5 = flag4; if (flag5) { this._last_ground_point = vector; } } } } else { this._last_enemy = xentity; this._last_npc = xentity2; this._last_entity_at = Time.time; } } } } }