private void ProcessAttractImpact(GameObject attacker, List <GameObject> targets, Vector3 pos, float attractOff, float disMin) { if (targets == null || targets.Count <= 0) { return; } foreach (GameObject target in targets) { if (target != null) { Vector3 attractDir = pos - target.transform.position; float distance = attractDir.magnitude; if (distance >= disMin) { Vector3 posOff = attractDir.normalized * attractOff; Vector3 targetPos = target.transform.position + posOff; Component controller = target.GetComponent <CharacterController>(); if (controller != null) { ((CharacterController)controller).Move(posOff); } else { target.transform.position += posOff; } LogicSystem.NotifyGfxUpdatePosition(target, targetPos.x, targetPos.y, targetPos.z); TriggerImpl.RecordTarget(GetAttacker(), target); } } } }
//用于上层逻辑检查通过后调用 public void StartSkill(int actorId, int skillId, float facedir) { GameObject obj = LogicSystem.GetGameObject(actorId); if (null != obj) { SkillLogicInfo logicInfo = m_SkillLogicInfos.Find(info => info.Sender == obj && info.SkillId == skillId); if (logicInfo != null) { return; } ChangeDir(obj, facedir); SkillInstanceInfo inst = NewSkillInstance(skillId); if (null != inst) { m_SkillLogicInfos.Add(new SkillLogicInfo(obj, inst)); } else { LogicSystem.NotifyGfxStopSkill(obj, skillId); return; } logicInfo = m_SkillLogicInfos.Find(info => info.Sender == obj && info.SkillId == skillId); if (null != logicInfo) { if (OnGfxShillStart != null) { OnGfxShillStart(obj, skillId); } LogicSystem.NotifyGfxAnimationStart(obj, true); logicInfo.SkillInst.Start(logicInfo.Sender); } } }
public static void ChangeAllDir(GameObject obj, float direction) { UnityEngine.Vector3 rotate = new UnityEngine.Vector3(0, direction * 180 / UnityEngine.Mathf.PI, 0); obj.transform.eulerAngles = rotate; LogicSystem.NotifyGfxUpdatePositionAndDir(obj, obj.transform.position.x, obj.transform.position.y, obj.transform.position.z, 0, direction, 0); }
/// <summary> /// Sections /// </summary> private void OnShootStart() { // Notify TriggerImpl.StopAllAnim(this.gameObject); LogicSystem.NotifyGfxAnimationStart(gameObject); if (ControlMove) { LogicSystem.NotifyGfxMoveControlStart(gameObject); } // Weapon TriggerImpl.ChangeWeaponById(this.gameObject, WeaponId); TriggerImpl.ChangeWeaponById(this.gameObject, SubWeaponId); // Animation TriggerImpl.PlayAnim(this.gameObject, ShootAnimInfo); SkillDuration = Mathf.Max(TriggerImpl.GetAnimTime(this.gameObject, ShootAnimInfo), SkillDuration); if (SupportRotateByHold) { DashFire.LogicSystem.EventChannelForGfx.Publish("ge_touch_dir", "ui", true); } if (SupportRotateByJoyStick) { TriggerImpl.ShowJoyStick(this.gameObject); } TriggerImpl.StartMoveById(this.gameObject, StartMovementId); SkillComponent.ChangeNextSection(); }
// Anim public static bool PlayAnims(GameObject target, params SkillAnimInfo[] infos) { Animation animCom = target.GetComponent <Animation>(); if (animCom == null) { LogicSystem.GfxLog("PlayAnim animation component miss!"); return(false); } for (int i = 0; i < infos.Length; ++i) { SkillAnimInfo info = infos[i]; if (info == null || info.AnimName == null || animCom[info.AnimName.name] == null) { continue; } animCom[info.AnimName.name].speed = info.AnimSpeed; animCom[info.AnimName.name].wrapMode = info.AnimWrapMode; animCom[info.AnimName.name].layer = info.AnimLayer; animCom.PlayQueued(info.AnimName.name, QueueMode.CompleteOthers); } return(true); }
public override bool Execute(object sender, SkillInstance instance, long delta, long curSectionTime) { GameObject obj = sender as GameObject; if (null != obj) { if (curSectionTime <= m_Duration) { float dist = (float)(int)delta / 1000.0f * m_Velocity; UnityEngine.Vector3 targetPos = obj.transform.position + obj.transform.forward * dist; CharacterController ctrl = obj.GetComponent <CharacterController>() as CharacterController; if (null != ctrl) { ctrl.Move(obj.transform.forward * dist); } else { obj.transform.position = targetPos; } LogicSystem.NotifyGfxUpdatePosition(obj, targetPos.x, targetPos.y, targetPos.z); return(true); } else { return(true); } } else { return(false); } }
/**点击玩家 弹出加好友,组队功能界面*/ void OnCheckPlayerInfo(int actorid) { try { SharedGameObjectInfo share_info = ArkCrossEngine.LogicSystem.GetSharedGameObjectInfo(actorid); GfxUserInfo userInfo; bool sign = true; for (int i = 0; i < DFMUiRoot.GfxUserInfoListForUI.Count; i++) { if (DFMUiRoot.GfxUserInfoListForUI[i].m_ActorId == actorid) { sign = false; userInfo = DFMUiRoot.GfxUserInfoListForUI[i]; UnityEngine.GameObject go = UIManager.Instance.GetWindowGoByName("DynamicFriend"); if (null != go) { go.GetComponent <DynamicFriend>().InitPanel(userInfo, new UnityEngine.Vector3()); } LogicSystem.PublishLogicEvent("ge_request_player_info", "lobby", userInfo.m_Nick); break; } } if (sign) { GfxSystem.PublishGfxEvent("ge_screen_tip", "ui", ArkCrossEngine.StrDictionaryProvider.Instance.GetDictString(557), UIScreenTipPosEnum.AlignCenter, UnityEngine.Vector3.zero); } } catch (Exception ex) { ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
private IEnumerator ReturnToMainCity() { yield return(new WaitForSeconds(5f)); //UIManager.Instance.HideWindowByName("JinBiVictoryPanel"); LogicSystem.PublishLogicEvent("ge_quit_battle", "lobby", false); }
// Update is called once per frame void Update() { if (IsActive) { if (Time.time < m_LastTriggerTime + m_AnimationPlayer.AnimationLenth(m_StartAnim)) { } else if (Time.time < m_LastTriggerTime + m_AnimationPlayer.AnimationLenth(m_StartAnim) + m_MovingTime) { if (!m_AnimationPlayer.IsPlaying(m_RotateAnim)) { m_AnimationPlayer.Play(m_RotateAnim); } if (!m_HasRotateEffect) { m_HasRotateEffect = true; if (null != m_RotateEffect) { GameObject rotateEffect = ResourceSystem.NewObject(m_RotateEffect, m_MovingTime) as GameObject; if (null != rotateEffect) { Transform parent = LogicSystem.FindChildRecursive(this.transform, m_RotateEffectBone); if (null != parent) { rotateEffect.transform.parent = parent; rotateEffect.transform.localPosition = Vector3.zero; rotateEffect.transform.localRotation = Quaternion.identity; m_EffectList.Add(rotateEffect); } } } } Vector3 motion = m_Direction * Time.deltaTime * m_Speed; if (!m_MoveController.isGrounded) { motion.y += -9.8f * Time.deltaTime; } m_MoveController.Move(m_Direction * Time.deltaTime * m_Speed); LogicSystem.NotifyGfxUpdatePosition(gameObject, this.transform.position.x, this.transform.position.y, this.transform.position.z, 0, this.transform.rotation.eulerAngles.y * Mathf.PI / 180f, 0); HandleDamage(); } else if (Time.time < m_LastTriggerTime + m_AnimationPlayer.AnimationLenth(m_StartAnim) + m_MovingTime + m_AnimationPlayer.AnimationLenth(m_EndAnim)) { if (!m_AnimationPlayer.IsPlaying(m_EndAnim)) { SetEndure(gameObject, false); m_AnimationPlayer.Play(m_EndAnim); } } else { StopSkill(); } if (IsLogicDead()) { NotifyNpcDead(gameObject); StopSkill(); } } }
protected string GetAnimationNameByType(GameObject obj, Animation_Type type) { if (null == obj) { return(null); } SharedGameObjectInfo info = LogicSystem.GetSharedGameObjectInfo(obj); if (null != info) { Data_ActionConfig curActionConfig = ActionConfigProvider.Instance.ActionConfigMgr.GetDataById(info.AnimConfigId); return(curActionConfig.m_ActionAnimNameContainer[type]); //Data_ActionConfig.Data_ActionInfo action = null; //if (null != curActionConfig && curActionConfig.m_ActionContainer.ContainsKey(type)) { // if (curActionConfig.m_ActionContainer[type].Count > 0) { // action = curActionConfig.m_ActionContainer[type][0]; // } //} //if (null != action) { // return action.m_AnimName; //} } return(null); }
public override bool Execute(object sender, SkillInstance instance, long delta, long curSectionTime) { if (curSectionTime < m_StartTime) { return(true); } if (curSectionTime > (m_StartTime + m_RemainTime)) { return(false); } GameObject obj = sender as GameObject; if (obj == null) { return(false); } if (!m_IsInited) { m_IsInited = true; m_SkillInstance = instance; SharedGameObjectInfo sgoi = LogicSystem.GetSharedGameObjectInfo(obj); if (sgoi != null) { sgoi.HandleEventCheckHitCanRelease = CheckHitCanRelease; } } return(true); }
protected void GeneralStartImpact(ImpactLogicInfo logicInfo) { InitLayer(logicInfo.Target, logicInfo); LogicSystem.NotifyGfxAnimationStart(logicInfo.Target, false); LogicSystem.NotifyGfxMoveControlStart(logicInfo.Target, logicInfo.ImpactId, false); InitMovement(logicInfo); }
protected void GeneralStopImpact(ImpactLogicInfo logicInfo) { if (IsLogicDead(logicInfo.Target)) { SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_RemoveBit, GfxCharacterState_Type.Stiffness); SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_RemoveBit, GfxCharacterState_Type.HitFly); SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_RemoveBit, GfxCharacterState_Type.GetUp); } else { ClearGfxStateFlag(logicInfo.Target); } logicInfo.CustomDatas.Clear(); //foreach=>for for (int i = 0; i < logicInfo.EffectsDelWithImpact.Count; ++i) { GameObject Obj = logicInfo.EffectsDelWithImpact[i]; ResourceSystem.RecycleObject(Obj); } //foreach(GameObject obj in logicInfo.EffectsDelWithImpact){ // ResourceSystem.RecycleObject(obj); //} ResetLayer(logicInfo.Target, logicInfo); LogicSystem.NotifyGfxAnimationFinish(logicInfo.Target, false); LogicSystem.NotifyGfxMoveControlFinish(logicInfo.Target, logicInfo.ImpactId, false); LogicSystem.NotifyGfxStopImpact(logicInfo.Sender, logicInfo.ImpactId, logicInfo.Target); }
private void DropWeapon(WeaponHand type) { if (m_Weapons.ContainsKey(type)) { GameObject weapon = m_Weapons[type]; Script_Util.DetachGameObject(weapon); GameObject.DestroyObject(weapon); m_Weapons.Remove(type); } // Make Sure Remove All Children Transform t = LogicSystem.FindChildRecursive(this.gameObject.transform, GetBoneName(type)); if (t != null) { int childCount = t.childCount; for (int index = 0; index < childCount; index++) { Transform child = t.GetChild(index); child.parent = null; GameObject.Destroy(child.gameObject); } t.DetachChildren(); } }
private List <int> GetSummonList(GameObject obj) { List <int> result = new List <int>(); SharedGameObjectInfo share_info = LogicSystem.GetSharedGameObjectInfo(obj); if (share_info == null) { return(result); } if (!m_IsSummon) { result.AddRange(share_info.Summons); } else if (share_info.SummonOwnerActorId >= 0) { SharedGameObjectInfo owner_info = LogicSystem.GetSharedGameObjectInfo(share_info.SummonOwnerActorId); if (owner_info != null) { for (int i = 0; i < owner_info.Summons.Count; ++i) { int actorid = owner_info.Summons[i]; if (actorid != share_info.m_ActorId) { result.Add(actorid); } } } } return(result); }
public void SendImpact(GameObject sender, GameObject target, ImpactInfo impactInfo, int hitCount = 1) { SendImpactWithOutDamage(target, impactInfo); SharedGameObjectInfo targetInfo = LogicSystem.GetSharedGameObjectInfo(target); LogicSystem.NotifyGfxHitTarget(sender, impactInfo.m_ImpactId, target, hitCount); }
private void SendStart(int action) { if (action == 1) { LogicSystem.PublishLogicEvent("ge_start_mpve", "lobby", sceneId); } }
public void ExchangeSlot(UISkillSlot draged, UISkillSlot surface) { //NGUIDebug.Log(surface.name); if (draged == null || surface == null) { return; } UISkillSlot skillSlot = null; foreach (UISkillSlot slot in skillStorageArr) { if (slot != null && slot.SkillId == draged.SkillId) { skillSlot = slot; break; } } if (null == skillSlot) { return; } //被拖拽的技能之前没有被装备上 if (skillSlot.EquipedPos != null && skillSlot.EquipedPos.Presets[UISkillSetting.presetIndex] == SlotPosition.SP_None) { //todo:发送消息通知装载操作 LogicSystem.PublishLogicEvent("ge_mount_skill", "lobby", UISkillSetting.presetIndex, skillSlot.SkillId, surface.slotIndex); } else { LogicSystem.PublishLogicEvent("ge_swap_skill", "lobby", UISkillSetting.presetIndex, skillSlot.SkillId, (SlotPosition)skillSlot.EquipedPos.Presets[UISkillSetting.presetIndex], surface.slotIndex); } }
//点击操作装备技能 public void SendMsg(int targetId, SlotPosition targetPos) { if (uiSkillInfo == null) { return; } //uiSkillInfo.SkillId为SourceId,==-1则返回 if (uiSkillInfo.SkillId == -1) { return; } int sourceId = uiSkillInfo.SkillId; UISkillSlot sourceSlot = uiSkillStorage.GetSlot(sourceId); int currentPreset = UISkillSetting.presetIndex; if (sourceSlot != null) { if (sourceSlot.EquipedPos != null && sourceSlot.EquipedPos.Presets[currentPreset] == SlotPosition.SP_None) { LogicSystem.PublishLogicEvent("ge_mount_skill", "lobby", currentPreset, sourceId, targetPos); } else { LogicSystem.PublishLogicEvent("ge_swap_skill", "lobby", currentPreset, sourceId, sourceSlot.EquipedPos.Presets[UISkillSetting.presetIndex], targetPos); } } }
private IEnumerator HandleGameLoading() { // fire ge_loading_start event handled by ui module, display splash screen & change to loading state LogicSystem.BeginLoading(); yield return(new WaitForSeconds(.1f)); // if in shipping version, update resource from server if (GlobalVariables.Instance.IsPublish) { yield return(StartCoroutine(HandleGameLoadingPublish())); } #if UNITY_ANDROID || UNITY_WEBGL // if not play game in editor, extract config data to disk else if (!UnityEngine.Application.isEditor) { string destPath = UnityEngine.Application.persistentDataPath + "/Tables"; if (!Directory.Exists(destPath)) { yield return(StartCoroutine(HandleGameLoadingNonEditor())); } } #endif LogicSystem.UpdateLoadingProgress(0.45f); // init all game system and start game StartLogic(); // fire ge_loading_finish event handled by ui module, notify ui finished LogicSystem.EndLoading(); }
public NewEmployeeViewModel(Person person, Employee empolyee, LogicSystem logic) { _logic = logic; Person = person; Employee = empolyee; Supervisor = GetSupervisor(Employee.Id); }
private byte[] EngineReadFileProxy(string filePath) { try { // Todo: load from bundle #if LoadDataTableFromCache filePath = Path.GetFullPath(filePath).ToLower(); byte[] bytes; if (CachedTables.TryGetValue(filePath, out bytes)) { return(bytes); } else { return(null); } #else byte[] buffer = null; buffer = File.ReadAllBytes(filePath); return(buffer); #endif } catch (Exception e) { LogicSystem.LogErrorFromGfx("Exception:{0}\n{1}", e.Message, e.StackTrace); return(null); } }
private void ApplyGravity(GameObject target, float delta, SkillAnimInfo animInfo) { if (target == null) { return; } if (!Script_Util.IsOnGround(target, GroundTweak)) { StartControlGravity(); m_Vertical += Gravity * delta; Vector3 posOff = m_Vertical * delta; Vector3 pos = target.transform.position + posOff; Component controller = target.GetComponent <CharacterController>(); if (controller != null) { ((CharacterController)controller).Move(posOff); } else { target.transform.position += posOff; } LogicSystem.NotifyGfxUpdatePosition(target, pos.x, pos.y, pos.z); } else { EndControlGravity(); } }
void OnClick() { if (m_IsPartnerFrag) { //todo:为伙伴灵魂石时,点击响应还待商讨 if (m_CanCompoundPartner) { LogicSystem.PublishLogicEvent("ge_compound_partner", "partner", m_PartnerId); } else { LogicSystem.EventChannelForGfx.Publish("ge_item_come_from", "ui", m_PartnerFragId); } } else { UIPartnerPanel partnerPanel = NGUITools.FindInParents <UIPartnerPanel>(gameObject); if (partnerPanel != null) { partnerPanel.SetPartnerInfo(m_PartnerId); } if (spSelectFlag != null) { NGUITools.SetActive(spSelectFlag.gameObject, true); } } }
//public EmployeeGenerator EmployeeGenerator { get => new EmployeeGenerator(EmployeeToGenerate); private set; } public MainWindowViewModel(LogicSystem logic) { _logic = logic; //default person if none is selected //Person = _logic.GetPersonByIdEmployee(1); }
private void AddAttachObject(Collider collider) { GameObject parent = m_ColliderInfo.GetCollider(); if (parent == null) { return; } AttachConfig attach_config = m_ColliderInfo.GetAttachConfig(); AttachTargetInfo attach_info = new AttachTargetInfo(); attach_info.ParentObj = parent; attach_info.TargetObj = collider.gameObject; attach_info.AttachNode = TriggerUtil.GetChildNodeByName(collider.gameObject, attach_config.AttachNodeName); UnityEngine.Vector3 hit_pos = parent.GetComponent <Collider>().ClosestPointOnBounds(attach_info.AttachNode.position); attach_info.ParentPos = attach_info.ParentObj.transform.InverseTransformPoint(hit_pos); attach_info.Rotate = attach_config.AttachRotation; attach_info.MoveControler = attach_info.TargetObj.GetComponent <CharacterController>(); m_AttachedObjects.Add(attach_info); UpdateAttachTargetPos(attach_info); LogicSystem.NotifyGfxMoveControlStart(attach_info.TargetObj, m_OwnSkill.SkillId, true); //Debug.Log("---AttachImpact: send " + attach_config.AttachImpact + " to " + attach_info.TargetObj.name); m_DamageManager.SendImpactToObject(m_DamageManager.GetOwner(), collider.gameObject, attach_config.AttachImpact, attach_config.AttachImpactTime, m_OwnSkill.SkillId, m_CurHitCountId); }
public void StopSkill(int actorId, bool isinterrupt) { GameObject obj = LogicSystem.GetGameObject(actorId); if (null == obj) { return; } int count = m_SkillLogicInfos.Count; for (int index = count - 1; index >= 0; --index) { SkillLogicInfo info = m_SkillLogicInfos[index]; if (info != null) { if (info.Sender == obj) { if (isinterrupt) { info.SkillInst.OnInterrupt(obj, 0); } else { info.SkillInst.OnSkillStop(obj, 0); } StopSkillInstance(info, isinterrupt); m_SkillLogicInfos.RemoveAt(index); } } } }
private void SkillStartHandler() { GestureArgs e = new GestureArgs(); e.name = GestureEvent.OnSkillStart.ToString(); LogicSystem.FireGestureEvent(e); }
void Start() { try { // if get notice content successfully, show notice window OpenNotice(); // register events object obj = LogicSystem.EventChannelForGfx.Subscribe <int>("ge_set_current_server", "ui", SetCurrentServer); if (obj != null) { m_EventList.Add(obj); } obj = LogicSystem.EventChannelForGfx.Subscribe <int, string>("ge_login_result", "lobby", OnLoginResult); if (obj != null) { m_EventList.Add(obj); } obj = LogicSystem.EventChannelForGfx.Subscribe <bool>("ge_rolelist_result", "lobby", OnRoleListResult); if (obj != null) { m_EventList.Add(obj); } obj = LogicSystem.EventChannelForGfx.Subscribe("ge_ui_unsubscribe", "ui", UnSubscribe); if (obj != null) { m_EventList.Add(obj); } // try get server last login, or read from server table m_ServerId = PlayerPrefs.GetInt("LastLoginServerId"); SetCurrentServer(m_ServerId); // try get logic server last login m_LogicServerId = PlayerPrefs.GetInt("LastLoginLogicServerId"); SetCurrentLogicServer(m_LogicServerId); // update client version string version = ""; // get device info ,including uuid, system info, etc. UNITY_EDITOR #if UNITY_EDITOR string deviceUniqueIdentifier = SystemInfo.deviceUniqueIdentifier + ((uint)UnityEngine.Application.dataPath.GetHashCode()).ToString(); #elif UNITY_ANDROID || UNITY_IOS string deviceUniqueIdentifier = SystemInfo.deviceUniqueIdentifier; #else string deviceUniqueIdentifier = System.Guid.NewGuid().ToString(); #endif Debug.Log("device uuid: " + deviceUniqueIdentifier); string system = "all"; LogicSystem.PublishLogicEvent("ge_device_info", "lobby", deviceUniqueIdentifier, version, system); NormLog.Instance.UpdateDeviceidAndVersion(deviceUniqueIdentifier, version); } catch (System.Exception ex) { ArkCrossEngine.LogicSystem.LogErrorFromGfx("Exception {0}\n{1}", ex.Message, ex.StackTrace); } }
private void StopImpact() { m_IsStartImpact = false; m_AttractImpactElapsed = 0; m_ImpactProcessElapsed = 0; m_ImpactElapsed = 0; m_AttractImpactProcessElapsed = 0; m_IsImpacting = false; m_IsAttractImpacting = false; Vector3 contactPointNormal = m_BulletInfo.MoveDir * (-1); m_BulletInfo.BulletEndEffectInfo.EffectPos += m_HitPos; m_BulletInfo.BulletEndEffectInfo.EffectRot += Quaternion.identity.eulerAngles; TriggerImpl.PlayEffect(m_BulletInfo.BulletEndEffectInfo); foreach (GameObject target in m_TargetAttractInfos) { if (target != null) { LogicSystem.NotifyGfxMoveControlFinish(target); } } ProcessSkillImpact(m_BulletInfo.Attacker, m_TargetEndImpactInfos, m_HitPos, m_BulletInfo.ImpactEndInfos); ProcessSkillImpactFromSender(m_BulletInfo.Attacker, m_BulletInfo.Attacker, m_TargetEndFromRoleImpactInfos, m_BulletInfo.ImpactEndFromRoleInfos); GameObject.DestroyObject(this.gameObject); }