public void TwoLayerInterLayer() { var actors = ActorHelper.Get(2); var edges = new List <Edge> { new Edge(actors[0], actors[1]) }; var layer1 = new Layer(edges); var layer2 = new Layer(edges); var interLayerEdges = new List <InterLayerEdge> { new InterLayerEdge { From = actors[0], To = actors[1], LayerFrom = layer1, LayerTo = layer2 } }; var network = new Network(); network.Actors = actors; network.InterLayerEdges = interLayerEdges; network.Layers.Add(layer1); network.Layers.Add(layer2); var threshold = 0.5; var relevances = new double[] { 0.51, 0.49 }; var flattened = localSimplification.BasedOnLayerRelevance(network, relevances, threshold); Assert.NotNull(flattened); Assert.NotEmpty(flattened.Layers); Assert.Equal(actors, flattened.Actors); Assert.Collection(flattened.FirstLayer.Edges, e => { Assert.Equal(actors[0], e.From); Assert.Equal(actors[1], e.To); Assert.Equal(2, e.Weight); } ); }
public void Validate(HeroKDA kdaData) { this.kdaData = kdaData; this.icon.SetSprite(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Icon_Dir, CSkinInfo.GetHeroSkinPic((uint)kdaData.HeroId, 0)), Singleton <CBattleSystem> .instance.m_FormScript, true, false, false); Player ownerPlayer = ActorHelper.GetOwnerPlayer(ref kdaData.actorHero); this.playerName.text = ownerPlayer.Name; this.heroName.text = kdaData.actorHero.handle.TheStaticData.TheResInfo.Name; this.level.text = kdaData.actorHero.handle.ValueComponent.actorSoulLevel.ToString(); this.killNum.text = kdaData.numKill.ToString(); this.deadNum.text = kdaData.numDead.ToString(); this.killMon.text = (kdaData.numKillMonster + kdaData.numKillSoldier).ToString(); this.killMon.text = kdaData.TotalCoin.ToString(); this.assistNum.text = kdaData.numAssist.ToString(); int num = 1; for (int i = 0; i < 6; i++) { ushort equipID = kdaData.Equips[i].m_equipID; if (equipID != 0) { num++; CUICommonSystem.SetEquipIcon(equipID, this.equipList[i].gameObject, Singleton <CBattleSystem> .instance.m_FormScript); } } for (int j = num; j <= 6; j++) { this.equipList[j - 1].gameObject.GetComponent <Image>().SetSprite(string.Format("{0}EquipmentSpace", CUIUtility.s_Sprite_Dynamic_Talent_Dir), Singleton <CBattleSystem> .instance.m_FormScript, true, false, false); } if (ownerPlayer == Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer()) { this.playerName.color = CUIUtility.s_Text_Color_Self; this.mineBg.CustomSetActive(true); } else { this.mineBg.CustomSetActive(false); } }
private void CheckTransmitShowParticalDistance(ref PoolObjHandle <ActorRoot> srcObj, ref PoolObjHandle <ActorRoot> targetObj) { if (!srcObj && !targetObj) { return; } if (targetObj.handle.Visible) { this.bCheckFilter = true; return; } Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer(); if (hostPlayer == null || !hostPlayer.Captain) { return; } int num = Horizon.QueryGlobalSight(); VInt3 worldLoc = new VInt3(targetObj.handle.location.x, targetObj.handle.location.z, 0); bool flag = Singleton <GameFowManager> .instance.IsVisible(worldLoc, hostPlayer.PlayerCamp); if (flag) { this.bCheckFilter = true; return; } int count = Singleton <GameObjMgr> .instance.HeroActors.get_Count(); for (int i = 0; i < count; i++) { PoolObjHandle <ActorRoot> ptr = Singleton <GameObjMgr> .instance.HeroActors.get_Item(i); if (ptr && !ptr.handle.ActorControl.IsDeadState && !ActorHelper.IsHostEnemyActor(ref ptr) && (targetObj.handle.location - hostPlayer.Captain.handle.location).sqrMagnitudeLong2D < (long)(num * num)) { this.bCheckFilter = true; break; } } }
public void GetKCommunities_One() { // O 5 // | \ / | // | 2 -- 3 -- 4 | // | / \ | // 1 6 var ac = ActorHelper.Get(7); var ne = new Network(); var ed = new List <Edge> { new Edge(ac[0], ac[1]), new Edge(ac[0], ac[2]), new Edge(ac[1], ac[2]), new Edge(ac[2], ac[3]), new Edge(ac[3], ac[4]), new Edge(ac[4], ac[5]), new Edge(ac[4], ac[5]), new Edge(ac[5], ac[6]), }; ne.Actors = ac; ne.Layers.Add(new Layer() { Edges = ed }); var kclique = new KClique(); var communties = kclique.GetKCommunities(ne, 3); Assert.NotEmpty(communties); Assert.Collection(communties, c => Assert.Collection(c.Actors.OrderBy(a => a.Name), a => Assert.Equal(ne.Actors[0], a), a => Assert.Equal(ne.Actors[1], a), a => Assert.Equal(ne.Actors[2], a) ) ); }
public override void Enter(AGE.Action _action, Track _track) { base.Enter(_action, _track); this.actorObj = _action.GetActorHandle(this.targetId); this.starTime = Singleton <FrameSynchr> .GetInstance().LogicFrameTick; if ((this.actorObj != 0) && ActorHelper.IsHostCtrlActor(ref this.actorObj)) { CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CBattleSystem.s_battleUIForm); if (form != null) { this.processBar = Utility.FindChild(form.gameObject, "GoBackProcessBar"); this.processBar.CustomSetActive(true); this.m_process = this.processBar.transform.Find("GoBackTime").GetComponent <Image>(); if (this.m_process != null) { this.m_process.fillAmount = 0f; } } } }
public void Refresh() { if (this.Target != null) { lstGoods.Children.Clear(); foreach (var item in this.Target.Inventory.GetContents().Where(i => !ActorHelper.HasFlag(i, "NoSell"))) { // Ensure that the buy prices have been set. ItemHelper.EnsureBuyCost(item, this.Target.Properties.GetValue <double>("MarkupPercentage")); ItemListItem listItem = ItemListItem.Create(item); listItem.CommerceType = CommerceType.Buy; listItem.Action += new ActionEventHandler(OnListItemAction); listItem.Refresh(); lstGoods.Children.Add(listItem); } this.HideLoading(); } if (this.Player != null) { lstInventory.Children.Clear(); foreach (var item in this.Player.Inventory.GetContents().Where(i => !ActorHelper.HasFlag(i, "NoSell"))) { // Ensure that the sell prices have been set. if (this.Target != null) { ItemHelper.EnsureSellCost(item, this.Target.Properties.GetValue <double>("MarkdownPercentage")); } ItemListItem listItem = ItemListItem.Create(item); listItem.CommerceType = CommerceType.Sell; listItem.Action += new ActionEventHandler(OnListItemAction); listItem.Refresh(); lstInventory.Children.Add(listItem); } } }
void OnTriggerExit(Collider other) { if (other.gameObject == null || other.gameObject.layer != LayerMask.NameToLayer("Player")) { return; } Actor localPlayer = Game.Instance.GetLocalPlayer(); if (localPlayer != null && localPlayer.GetModelParent().Equals(other.gameObject) == false) { return; } ActorMono act_mono = ActorHelper.GetActorMono(other.gameObject); if (act_mono == null) { return; } Player act = act_mono.BindActor as Player; if (act != null && act.UID.Equals(Game.GetInstance().LocalPlayerID)) { if (ExitId > 0) { UranusManager.Instance.ActiveLevelNode(ExitId); if (LifeTime == Neptune.Collider.ETypeLifeTime.ONCE) { ColliderObjectManager.Instance.RemoveColliderObject(Id); } } ColliderObjectManager.Instance.TriggerColliderObject(Id); } }
public void GetPercolationNetwork() { var kclique = new KClique(); var actors = ActorHelper.ActorsFrom("a0", "a1"); var cliques = new List <List <Actor> >() { new List <Actor> { actors[0], actors[1] }, new List <Actor> { actors[1], actors[0] } }; var cliqueToActor = kclique.GetCliqueToActor(cliques); var membership = kclique.AssignMembership(cliques); var network = kclique.GetPercolationNetwork(cliques, membership, cliqueToActor, 2); Assert.NotNull(network); Assert.NotEmpty(network.Layers); Assert.NotEmpty(network.Actors); var cliqueActors = cliques.Select(c => cliqueToActor[c]).ToList(); Assert.Equal(network.Actors, cliqueActors); var c = new Edge(cliqueActors[0], cliqueActors[1]); Assert.Collection(network.Layers[0].Edges, e => Assert.True( e.Pair == (e.From, e.To) || e.Pair == (e.To, e.From) ) ); }
public override void Process(AGE.Action _action, Track _track) { PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId); if (actorHandle == 0) { if (ActionManager.Instance.isPrintLog) { } } else { if (this.bNormal) { this.bCheck = !(CGuildSystem.s_isGuildMaxGrade && ActorHelper.IsHostActor(ref actorHandle)); } else { this.bCheck = CGuildSystem.s_isGuildMaxGrade && ActorHelper.IsHostActor(ref actorHandle); } base.Process(_action, _track); } }
public void CommunitiesDistinctWithMetadata() { var actors = ActorHelper.Get(2); var communities = new List <Community> { new Community(actors[0]), new Community(actors[1]), }; var output = writer.ToString(actors, communities, true); var lines = output.Split('\n'); Assert.Collection(lines, line => Assert.Equal("0 0", line), line => Assert.Equal("1 1", line), line => Assert.Equal("# Actors", line), line => Assert.Equal("0 a0", line), line => Assert.Equal("1 a1", line), line => Assert.Equal("# Communities", line), line => Assert.Equal("0 c0", line), line => Assert.Equal("1 c1", line), line => Assert.Equal("", line) ); }
public void GetComponent_OneComponent() { var actors = ActorHelper.ActorsFrom("a0", "a1", "a2", "a3"); var layer = new Layer(); layer.Edges.Add(new Edge(actors[0], actors[1])); layer.Edges.Add(new Edge(actors[0], actors[3])); layer.Edges.Add(new Edge(actors[1], actors[2])); foreach (var actor in actors) { var component = Connected .GetComponent(layer, actor) .OrderBy(a => a.Name); Assert.Collection(component, item => Assert.Equal(item, actors[0]), item => Assert.Equal(item, actors[1]), item => Assert.Equal(item, actors[2]), item => Assert.Equal(item, actors[3]) ); } }
public override void Enter(Action _action, Track _track) { SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); PoolObjHandle <ActorRoot> originator = refParamObject.Originator; if (!ActorHelper.IsHostCtrlActor(ref originator) || Singleton <WatchController> .instance.IsWatching) { this.bInvalid = true; return; } this.heightRate = ((this.heightRate < 1f) ? 1f : this.heightRate); if (MonoSingleton <CameraSystem> .instance.ZoomRateFromAge != this.heightRate) { this.setFinished = false; this.from = ((this.heightRate > 1f) ? 1f : MonoSingleton <CameraSystem> .instance.ZoomRateFromAge); this.to = ((this.heightRate > 1f) ? this.heightRate : 1f); } else { this.setFinished = true; } base.Enter(_action, _track); }
public void RedundancyEqualsOne() { var a = ActorHelper.Get(2); var e0 = new List <Edge> { new Edge(a[0], a[1]) }; var e1 = new List <Edge> { new Edge(a[1], a[0]) }; var l0 = new Layer(e0); var l1 = new Layer(e1); var l = new List <Layer> { l0, l1 }; var n = new Network(l, a); var c = new Community(a); var r = Redundancy.Compute(c, n); Assert.Equal(1.0, r); }
public void When_handling_message_Then_it_is_forwarded_to_the_actor_and_sender_is_set() { var mailbox = A.Fake <Mailbox>(); var actor = ActorHelper.CreateActorDirectly <TestActor>(); var actorInstantiator = A.Fake <ActorInstantiator>(); //Note: NEVER do this in actual code (returning a premade instance). Always create new instances. A.CallTo(() => actorInstantiator.CreateNewActor()).Returns(actor); var actorRef = new LocalActorRef(new TestActorSystem(), actorInstantiator, new RootActorPath("test"), mailbox, A.Dummy <InternalActorRef>()); var message = new object(); var sender = A.Fake <ActorRef>(); A.CallTo(() => sender.Name).Returns("SenderActor"); //Send Create message so that the instance is created actorRef.HandleSystemMessage(new SystemMessageEnvelope(actorRef, new CreateActor(), A.Fake <ActorRef>())); actorRef.HandleMessage(new Envelope(actorRef, message, sender)); actor.ReceivedMessages.Should().HaveCount(1); actor.ReceivedMessages[0].Item2.Should().BeSameAs(message); actor.ReceivedMessages[0].Item1.Name.Should().Be("SenderActor"); }
public override void Leave(AGE.Action _action, Track _track) { base.Leave(_action, _track); if (!this.bEyeObj) { if (this.m_particleObj != null) { this.m_particleObj.transform.parent = null; ActionManager.DestroyGameObject(this.m_particleObj); } GameObject gameObject = _action.GetGameObject(this.targetId); if ((this.targetId >= 0) && (gameObject != null)) { if (this.applyActionSpeedToAnimation) { _action.RemoveTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Anim, gameObject); } if (this.applyActionSpeedToParticle) { _action.RemoveTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Fx, gameObject); } this.RemoveBullet(); ActorHelper.DetachActorRoot(gameObject); ActionManager.DestroyGameObjectFromAction(_action, gameObject); } } if (this.actorSlot != null) { PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.parentId); if (actorHandle != 0) { actorHandle.handle.RemoveActorRootSlot(this.actorSlot); } this.actorSlot = null; } }
public void GetAdjacentCliques_DistinctCliques() { var actors = ActorHelper.ActorsFrom("a0", "a1"); var cliques = new List <List <Actor> >() { new List <Actor> { actors[0], }, new List <Actor> { actors[1] } }; var kclique = new KClique(); var membership = kclique.AssignMembership(cliques); foreach (var clique in cliques) { var adjacent = kclique.GetAdjacentCliques(clique, membership); Assert.Empty(adjacent); } }
public void GetCliqueToActor() { var actors = ActorHelper.ActorsFrom("a0", "a1"); var cliques = new List <List <Actor> >() { new List <Actor> { actors[0], actors[1] }, new List <Actor> { actors[1], actors[0] } }; var cliquesActors = new KClique().GetCliqueToActor(cliques); foreach (var clique in cliques) { Assert.True(cliquesActors.ContainsKey(clique)); Assert.NotNull(cliquesActors[clique]); } }
private void OnPlayerDead(ref GameDeadEventParam prm) { if (prm.src && ActorHelper.IsHostCtrlActor(ref prm.src) && !this.bFreeCamera && !Singleton <WatchController> .GetInstance().IsWatching) { if (this.MobaCamera && prm.src.handle.ActorControl != null) { this.MobaCamera.SetAbsoluteLockLocation((Vector3)prm.src.handle.ActorControl.actorLocation); } if (Singleton <CBattleSystem> .GetInstance().FightForm != null) { Singleton <CBattleSystem> .GetInstance().FightForm.EnableCameraDragPanelForDead(); } if (!prm.src.handle.TheStaticData.TheBaseAttribute.DeadControl) { this.enableLockedCamera = false; this.enableAbsoluteLocationLockCamera = true; } this.StopDisplacement(); if (this.MobaCamera) { this.MobaCamera._lockTransitionRate = 1f; } } }
// 创建对应的角色 public void CreateActor(int index) { if (index >= 0 && index < mData.Count) { //if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetRoleList() != null) //{ // List<uint> npc_id = SDKHelper.GetRoleList(); // int rid = (int)mData[index].rid - 1; // UnitID actor_uid = ClientModel.CreateClientModelByActorIdForLua(ActorHelper.RoleIdToCreateTypeId(npc_id[rid]), OnResLoaded); // var client_model = ActorManager.Instance.GetActor(actor_uid) as ClientModel; // client_model.AttackSpeed = 1.0f; // mActorGameObjects.Add(client_model); // return; //} uint type_idx = ActorHelper.RoleIdToTypeId(mData [index].rid); List <uint> model_list = new List <uint>(); List <uint> fashion_list = new List <uint>(); ActorHelper.GetModelFashionList(mData[index].shows, model_list, fashion_list); if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetSwitchModel() && SDKHelper.GetFashion() != 0) { fashion_list.Add(SDKHelper.GetFashion()); } var model_id_list = ActorManager.ReplaceModelList(model_list, (Actor.EVocationType)mData [index].rid, true); ClientModel actor = ClientModel.CreateClientModel(type_idx, mData[index].uuid, model_id_list, fashion_list, mData[index].effects, OnResLoaded, false, true); // 攻速必须为1,不然出场特效与动作匹配不上 actor.AttackSpeed = 1.0f; mActorGameObjects.Add(actor); actor.Freeze(DBActor.UF_ANIMATION); } }
private void refresh_timer_Tick(object sender, EventArgs e) { if (bot != null) { bot.Update(refresh_timer.Interval * 0.001f); } if (m_Navmesh.IsUpdating) { Actor local_actor = ActorHelper.GetLocalActor(); if (local_actor == null) { return; } render_center.X = local_actor.x0A8_WorldPosX; render_center.Y = local_actor.x0AC_WorldPosY; m_Navmesh.Navigator.CurrentPos = new Vec3(local_actor.x0A8_WorldPosX, local_actor.x0AC_WorldPosY, local_actor.x0B0_WorldPosZ); } Refresh(); }
private void onMonsterGroupDead(ref GameDeadEventParam param) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); DebugHelper.Assert(masterRoleInfo != null, "Master Roleinfo is NULL!"); if ((masterRoleInfo != null) && (param.src != 0)) { if (param.src.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster) { MonsterWrapper wrapper = param.src.handle.AsMonster(); object[] inParameters = new object[] { param.src.handle.TheActorMeta.ConfigId }; DebugHelper.Assert((wrapper != null) && (wrapper.cfgInfo != null), "Can't find Monster config -- ID: {0}", inParameters); if ((wrapper.cfgInfo == null) || (wrapper.cfgInfo.bMonsterType == 1)) { return; } } if ((param.atker != 0) && ActorHelper.IsHostActor(ref param.atker)) { if ((Singleton <BattleLogic> .GetInstance().DragonId != 0) && (param.src.handle.TheActorMeta.ConfigId == Singleton <BattleLogic> .GetInstance().DragonId)) { if (!masterRoleInfo.IsNewbieAchieveSet(4)) { Singleton <CNewbieAchieveSys> .GetInstance().ShowAchieve(enNewbieAchieve.COM_ACNT_CLIENT_BITS_TYPE_KILL_LITTLEDRAGON); masterRoleInfo.SetNewbieAchieve(4, true, false); } } else if (!masterRoleInfo.IsNewbieAchieveSet(3)) { this.ShowAchieve(enNewbieAchieve.COM_ACNT_CLIENT_BITS_TYPE_DESTORY_MONSTERHOME); masterRoleInfo.SetNewbieAchieve(3, true, false); } } } }
public static void HUDMechArmorReadout_SetHoveredArmor_Postfix(HUDMechArmorReadout __instance, ArmorLocation location, Mech ___displayedMech) { if (__instance == null || __instance.HUD == null || __instance.HUD.SelectedActor == null || __instance.HUD.SelectedTarget == null) { return; // nothing to do } if (__instance.UseForCalledShots && location == ArmorLocation.Head) { Mod.Log.Trace("HUDMAR:SHA entered"); bool canAlwaysCalledShot = false; List <Statistic> customStats = ActorHelper.FindCustomStatistic(ModStats.CalledShowAlwaysAllow, __instance.HUD.SelectedActor); foreach (Statistic stat in customStats) { if (stat.ValueType() == typeof(bool) && stat.Value <bool>()) { canAlwaysCalledShot = true; } } bool canBeTargeted = __instance.HUD.SelectedTarget.IsShutDown || __instance.HUD.SelectedTarget.IsProne || canAlwaysCalledShot; Mod.Log.Debug($" Hover - target:({___displayedMech.DistinctId()}) canBeTargeted:{canBeTargeted} by attacker:({__instance.HUD.SelectedActor.DistinctId()})"); Mod.Log.Debug($" isShutdown:{___displayedMech.IsShutDown} isProne:{___displayedMech.IsProne} canAlwaysCalledShot:{canAlwaysCalledShot}"); if (!canBeTargeted) { Mod.Log.Debug(" preventing targeting of head."); __instance.ClearHoveredArmor(ArmorLocation.Head); } else { Mod.Log.Debug(" target head can be targeted."); } } }
/// <summary> /// 响应点击玩家的消息 /// </summary> /// <param name="data"></param> void OnClickPlayer(CEventBaseArgs data) { if (SceneHelp.Instance.IgnoreClickPlayer) { return; } GameObject select_object = (GameObject)data.arg; if (select_object != null) { ActorMono act_mono = ActorHelper.GetActorMono(select_object); if (act_mono != null && act_mono.BindActor != null) { if (act_mono.BindActor.IsDead() || act_mono.BindActor.IsLocalPlayer) { return; } m_LvText.text = act_mono.BindActor.Level.ToString(); for (int i = 0; i < m_IconImage.childCount; ++i) { m_IconImage.GetChild(i).gameObject.SetActive(false); } int voc_id = (int)act_mono.BindActor.VocationID; var voc_image_object = m_IconImage.Find(voc_id.ToString()); if (voc_image_object != null) { voc_image_object.gameObject.SetActive(true); } m_Target = select_object; gameObject.SetActive(true); } } }
public override void Enter(AGE.Action _action, Track _track) { SkillUseContext refParamObject = null; Vector3 bindPosOffset = this.bindPosOffset; Quaternion bindRotOffset = this.bindRotOffset; GameObject gameObject = _action.GetGameObject(this.targetId); GameObject obj3 = _action.GetGameObject(this.objectSpaceId); Transform transform = null; Transform transform2 = null; if (this.bindPointName.Length == 0) { if (gameObject != null) { transform = gameObject.transform; PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId); this.followTransform = transform; } else if (obj3 != null) { transform2 = obj3.transform; } } else { GameObject obj4 = null; if (gameObject != null) { obj4 = SubObject.FindSubObject(gameObject, this.bindPointName); if (obj4 != null) { transform = obj4.transform; } else if (gameObject != null) { transform = gameObject.transform; } } else if (obj3 != null) { obj4 = SubObject.FindSubObject(obj3, this.bindPointName); if (obj4 != null) { transform2 = obj4.transform; } else if (gameObject != null) { transform2 = obj3.transform; } } } if ((!this.bEnableOptCull || (transform2 == null)) || (transform2.gameObject.layer != LayerMask.NameToLayer("Hide"))) { string resourceName; if (this.bBulletPos) { VInt3 zero = VInt3.zero; _action.refParams.GetRefParam("_BulletPos", ref zero); bindPosOffset = (Vector3)zero; bindRotOffset = Quaternion.identity; if (this.bBulletDir) { VInt3 num2 = VInt3.zero; if (_action.refParams.GetRefParam("_BulletDir", ref num2)) { bindRotOffset = Quaternion.LookRotation((Vector3)num2); } } } else if (transform != null) { bindPosOffset = transform.localToWorldMatrix.MultiplyPoint(this.bindPosOffset); bindRotOffset = transform.rotation * this.bindRotOffset; } else if (transform2 != null) { if (obj3 != null) { PoolObjHandle <ActorRoot> handle2 = _action.GetActorHandle(this.objectSpaceId); if (handle2 != 0) { bindPosOffset = (Vector3)IntMath.Transform((VInt3)this.bindPosOffset, handle2.handle.forward, (VInt3)obj3.transform.position); bindRotOffset = Quaternion.LookRotation((Vector3)handle2.handle.forward) * this.bindRotOffset; } } else { bindPosOffset = transform2.localToWorldMatrix.MultiplyPoint(this.bindPosOffset); bindRotOffset = transform2.rotation * this.bindRotOffset; } if (this.bBulletDir) { VInt3 num3 = VInt3.zero; if (_action.refParams.GetRefParam("_BulletDir", ref num3)) { bindRotOffset = Quaternion.LookRotation((Vector3)num3) * this.bindRotOffset; } } else if (this.bBullerPosDir) { if (refParamObject == null) { refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); } if (refParamObject != null) { PoolObjHandle <ActorRoot> originator = refParamObject.Originator; if ((originator != 0) && (originator.handle.gameObject != null)) { Vector3 forward = transform2.position - originator.handle.gameObject.transform.position; bindRotOffset = Quaternion.LookRotation(forward) * this.bindRotOffset; } } } } bool isInit = false; if (this.bUseSkin) { resourceName = SkinResourceHelper.GetResourceName(_action, this.resourceName, this.bUseSkinAdvance); } else { resourceName = this.resourceName; } if (refParamObject == null) { refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); } bool flag2 = true; int particleLOD = GameSettings.ParticleLOD; if (GameSettings.DynamicParticleLOD) { if (((refParamObject != null) && (refParamObject.Originator != 0)) && (refParamObject.Originator.handle.TheActorMeta.PlayerId == Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().PlayerId)) { flag2 = false; } if (!flag2 && (particleLOD > 1)) { GameSettings.ParticleLOD = 1; } MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag2; } this.particleObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(resourceName, true, SceneObjType.ActionRes, bindPosOffset, bindRotOffset, out isInit); if (GameSettings.DynamicParticleLOD) { MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false; } if (this.particleObject == null) { if (GameSettings.DynamicParticleLOD) { MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag2; } this.particleObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(this.resourceName, true, SceneObjType.ActionRes, bindPosOffset, bindRotOffset, out isInit); if (GameSettings.DynamicParticleLOD) { MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false; } if (this.particleObject == null) { if (GameSettings.DynamicParticleLOD) { GameSettings.ParticleLOD = particleLOD; } return; } } if (GameSettings.DynamicParticleLOD) { GameSettings.ParticleLOD = particleLOD; } ParticleHelper.IncParticleActiveNumber(); if (transform != null) { if (!this.bOnlyFollowPos) { PoolObjHandle <ActorRoot> handle4 = (transform.gameObject != gameObject) ? ActorHelper.GetActorRoot(transform.gameObject) : _action.GetActorHandle(this.targetId); this.particleObject.transform.parent = transform; } else { this.offsetPosition = bindPosOffset - transform.position; } } if (isInit) { if (this.enableLayer || this.enableTag) { Transform[] transformArray = this.particleObject.GetComponentsInChildren <Transform>(); for (int i = 0; i < transformArray.Length; i++) { if (this.enableLayer) { transformArray[i].gameObject.layer = this.layer; } if (this.enableTag) { transformArray[i].gameObject.tag = this.tag; } } } ParticleSystem[] componentsInChildren = this.particleObject.GetComponentsInChildren <ParticleSystem>(); if (componentsInChildren != null) { for (int j = 0; j < componentsInChildren.Length; j++) { ParticleSystem system1 = componentsInChildren[j]; system1.startSize *= this.scaling.x; ParticleSystem system2 = componentsInChildren[j]; system2.startLifetime *= this.scaling.y; ParticleSystem system3 = componentsInChildren[j]; system3.startSpeed *= this.scaling.z; Transform transform1 = componentsInChildren[j].transform; transform1.localScale = (Vector3)(transform1.localScale * this.scaling.x); } } } string layerName = "Particles"; if ((transform != null) && (transform.gameObject.layer == LayerMask.NameToLayer("Hide"))) { layerName = "Hide"; } this.particleObject.SetLayer(layerName, false); ParticleSystem component = this.particleObject.GetComponent <ParticleSystem>(); if (component != null) { component.Play(true); } if (this.applyActionSpeedToParticle) { _action.AddTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Fx, this.particleObject); } } }
public void SelectActor(int actor_index) { if (!IsShow) { return; } for (int i = 0; i < mActorGameObjects.Count; ++i) { Actor actor = mActorGameObjects [i]; if (actor != null) { actor.mVisibleCtrl.SetActorVisible(i == actor_index, VisiblePriority.EXCEPT); } } if (actor_index >= 0 && actor_index < mActorGameObjects.Count) { Actor selectObj = mActorGameObjects [actor_index]; if (selectObj != null)// 在切场景时,有可能选中的角色已经被销毁 { if (SelectActorScene.Instance != null) { SelectActorScene.Instance.PreviewObject = selectObj.GetModelParent(); } PreviewLight.SelectLight(1, mData[actor_index].rid); } } if (actor_index < mData.Count) { string name = System.Text.Encoding.UTF8.GetString(mData[actor_index].name); mPowerText.text = xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_93") + ActorHelper.GetDisplayBattlePower(mData[actor_index].battle_power); } }
/// <summary> /// 响应注册的网络消息 /// </summary> /// <param name="protocol"></param> /// <param name="data"></param> void HandleCreateRole(ushort protocol, byte[] data) { if (protocol != NetMsg.MSG_CREATE_ROLE) { return; } var create_role = S2CPackBase.DeserializePack <S2CCreateRole>(data); if (create_role.result != 1) // 创建不成功 { string content = ""; DBErrorCode db_error_code = (DBErrorCode)DBManager.GetInstance().GetDB(typeof(DBErrorCode).Name); DBErrorCode.ErrorInfo errorInfo = db_error_code.GetErrorInfo(create_role.result); if (errorInfo == null) { content = xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_35"); } else { content = errorInfo.mDesc; } GameDebug.LogError(string.Format("服务端报错: {0}", content)); UINotice.GetInstance().ShowMessage(content); UIManager.Instance.ShowWaitScreen(false); return; } // 保存本地玩家ID UnitID uid = new UnitID(); uid.type = (byte)EUnitType.UNITTYPE_PLAYER; uid.obj_idx = (uint)create_role.uuid; Game.GetInstance().LocalPlayerID = uid; Game.GetInstance().LocalPlayerTypeID = ActorHelper.RoleIdToTypeId(mVocationId); Game.GetInstance().LocalPlayerName = mNameInputField.text; // 保存角色职业信息 GlobalConfig.GetInstance().LoginInfo.RId = create_role.uuid.ToString(); GlobalConfig.GetInstance().LoginInfo.Job = mVocationId.ToString(); GlobalConfig.GetInstance().LoginInfo.Level = "0"; GlobalConfig.GetInstance().LoginInfo.CreateRoleTime = create_role.now.ToString(); // 通知服务端 var enter_game = new C2SEnterGame(); enter_game.uuid = create_role.uuid; NetClient.GetBaseClient().SendData <C2SEnterGame>(NetMsg.MSG_ENTER_GAME, enter_game); // 通知控制服 ControlServerLogHelper.GetInstance().PostRoleInfo(); // 通知sdk,sendRoleInfo2SDK要求等级最小为1,需要特殊处理 GlobalConfig.GetInstance().LoginInfo.Level = "1"; SDKControler.getSDKControler().sendRoleInfo2SDK((int)SDKControler.RoleEvent.CREATE_ROLE); // 创角埋点数据上报 if (xc.Const.Region == xc.RegionType.KOREA) { xc.BuriedPointHelper.ReportTapjoyEvnet("account generate"); } // 注册FCM DBOSManager.getOSBridge().registerFCM(); // 注册推送服务 DBOSManager.getOSBridge().registerPush(); }
private void onActorDead(ref GameDeadEventParam param) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); DebugHelper.Assert(masterRoleInfo != null, "Master Roleinfo is NULL!"); if (masterRoleInfo != null) { if ((param.atker != 0) && ActorHelper.IsHostActor(ref param.atker)) { if (param.src.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster) { MonsterWrapper wrapper = param.src.handle.AsMonster(); object[] inParameters = new object[] { param.src.handle.TheActorMeta.ConfigId }; DebugHelper.Assert((wrapper != null) && (wrapper.cfgInfo != null), "Can't find Monster config -- ID: {0}", inParameters); if ((wrapper.cfgInfo.bMonsterType == 1) && !masterRoleInfo.IsNewbieAchieveSet(0)) { this.ShowAchieve(enNewbieAchieve.COM_ACNT_CLIENT_BITS_TYPE_KILL_SOLDIER); masterRoleInfo.SetNewbieAchieve(0, true, false); } } else if (param.src.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Organ) { ResOrganCfgInfo dataCfgInfoByCurLevelDiff = OrganDataHelper.GetDataCfgInfoByCurLevelDiff(param.src.handle.TheActorMeta.ConfigId); object[] objArray2 = new object[] { param.src.handle.TheActorMeta.ConfigId }; DebugHelper.Assert(dataCfgInfoByCurLevelDiff != null, "Can't find Organ config -- ID: {0}", objArray2); if (dataCfgInfoByCurLevelDiff.bOrganType == 1) { if (!masterRoleInfo.IsNewbieAchieveSet(1)) { this.ShowAchieve(enNewbieAchieve.COM_ACNT_CLIENT_BITS_TYPE_DESTORY_ARROWTOWER); masterRoleInfo.SetNewbieAchieve(1, true, false); } } else if ((dataCfgInfoByCurLevelDiff.bOrganType == 2) && !masterRoleInfo.IsNewbieAchieveSet(2)) { this.ShowAchieve(enNewbieAchieve.COM_ACNT_CLIENT_BITS_TYPE_DESTORY_BASETOWER); masterRoleInfo.SetNewbieAchieve(2, true, false); } } } if ((param.src.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (param.atker != 0)) { if (ActorHelper.IsHostActor(ref param.atker)) { if (!masterRoleInfo.IsNewbieAchieveSet(8)) { this.ShowAchieve(enNewbieAchieve.COM_ACNT_CLIENT_BITS_TYPE_KILL_HERO); masterRoleInfo.SetNewbieAchieve(8, true, false); } } else if (param.atker.handle.TheActorMeta.ActorType != ActorTypeDef.Actor_Type_Hero) { HeroWrapper actorControl = param.src.handle.ActorControl as HeroWrapper; if (actorControl != null) { PoolObjHandle <ActorRoot> lastHeroAtker = actorControl.LastHeroAtker; if (((lastHeroAtker != 0) && ActorHelper.IsHostActor(ref lastHeroAtker)) && !masterRoleInfo.IsNewbieAchieveSet(8)) { this.ShowAchieve(enNewbieAchieve.COM_ACNT_CLIENT_BITS_TYPE_KILL_HERO); masterRoleInfo.SetNewbieAchieve(8, true, false); } } } } } }
public void SetGameObject(int _index, GameObject go) { this.actorHandles.set_Item(_index, ActorHelper.GetActorRoot(go)); this.gameObjects[_index] = go; }
/// <summary> /// 设置怪物挂架的tips /// </summary> /// <param name="info"></param> public void SetMonsterTipsInfo(MiniMapPointInfo info) { mCurrentMonsterInfo = info; string key = string.Format("{0}_{1}", info.Tag, m_CurSceneId); // F副本.xlsx -- 刷怪点信息 var data_actor_tag = DBManager.Instance.QuerySqliteRow <string>(GlobalConfig.DBFile, "data_actor_tag", "csv_id", key); //服务端不建议改表格式 //List<Dictionary<string, string>> data_actor_tag = null; //string key = string.Empty; //SDKConfig sdk_config = SDKHelper.GetSDKConfig(); //if (sdk_config != null && SDKHelper.IsCopyBag() && AuditManager.Instance.Open) //{ // key = string.Format("{0}_{1}{2}", info.Tag, m_CurSceneId, sdk_config.SDKNamePrefix); // data_actor_tag = DBManager.Instance.QuerySqliteRow<string>(GlobalConfig.DBFile, "data_actor_tag", "csv_id", key); //} ////当对应的马甲包没配置对应的数据时,就直接用正式数据 //if (data_actor_tag == null || data_actor_tag.Count == 0) //{ // key = string.Format("{0}_{1}", info.Tag, m_CurSceneId);// 唯一id由{tag_id}_{map_id}组成 // data_actor_tag = DBManager.Instance.QuerySqliteRow<string>(GlobalConfig.DBFile, "data_actor_tag", "csv_id", key); //} string titlestr = string.Empty; string contentstr = string.Empty; if (info.PointType != MiniMapPointType.Boss) // 普通怪物 { if (data_actor_tag.Count > 0) { var table = data_actor_tag[0]; uint level = DBTextResource.ParseUI(table["min_level"]); string levelDesc = string.Empty; uint peakLevel = 0; bool isPeak = TransferHelper.IsPeak(level, out peakLevel); if (isPeak) { var fmt = DBConstText.GetText("UI_PLAYER_PEAK_LEVEL_FORMAT"); // 巅峰{0}级 levelDesc = string.Format(fmt, peakLevel); } else { var fmt = DBConstText.GetText("UI_PLAYER_LEVEL_FORMAT"); // {0}级 levelDesc = string.Format(fmt, peakLevel); } uint def = DBTextResource.ParseUI(table["min_def"]); string _def = string.Empty; if (LocalPlayerManager.Instance.Level < level) { levelDesc = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_108"), GameConst.COLOR_DARK_RED, levelDesc); } else { levelDesc = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_108"), GameConst.COLOR_DARK_GREEN, levelDesc); } var Def = LocalPlayerManager.Instance.LocalActorAttribute.Attribute[GameConst.AR_DEF].Value; if (Def < def) { _def = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_109"), GameConst.COLOR_DARK_RED, def); } else { _def = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_109"), GameConst.COLOR_DARK_GREEN, def); } titlestr = levelDesc + _def; StringBuilder award_desc = new StringBuilder(150); award_desc.AppendFormat(xc.TextHelper.GetTranslateText(table["tips1_format"]), table["tips1"]); award_desc.Append('\n'); award_desc.AppendFormat(xc.TextHelper.GetTranslateText(table["tips2_format"]), table["tips2"]); award_desc.Append('\n'); award_desc.AppendFormat(xc.TextHelper.GetTranslateText(table["tips3_format"]), table["tips3"]); contentstr = award_desc.ToString(); } else { titlestr = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_110")); contentstr = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_111"));; } } else { if (GlobalConst.IsBanshuVersion) { titlestr = string.Format(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_112"), GameConst.COLOR_DARK_RED, info.BlackName, info.Level); } else { titlestr = string.Format("{0}{1} Lv{2}</color>", GameConst.COLOR_DARK_RED, info.BlackName, info.Level); } uint actorId = (uint)info.ActorId; bool isSouthLandBoss = ActorHelper.IsSouthLandBoss(actorId); // 南天圣地boss bool isElementAreaBoss = ActorHelper.IsElementAreaBoss(actorId); // 元素禁地boss if (isSouthLandBoss || isElementAreaBoss) { // 浊气值 uint evilValue = 0; if (isSouthLandBoss) { var evilItem = DBManager.Instance.GetDB <DBEvilValue>().GetData(actorId); if (null != evilItem) { evilValue = evilItem.Value; } } else { var evilItem = DBManager.Instance.GetDB <DBElementAreaEvilValue>().GetData(actorId); if (null != evilItem) { evilValue = evilItem.Value; } } string strEvilValue = DBConstText.GetText("SOUTH_LAND_EVIL_VALUE"); // 浊气值: titlestr = string.Format("{0}\n{1}{2}{3}</color>", titlestr, strEvilValue, GameConst.COLOR_DARK_YELLOW, evilValue); } if (data_actor_tag.Count > 0) { var table = data_actor_tag[0]; StringBuilder award_desc = new StringBuilder(150); award_desc.AppendFormat(xc.TextHelper.GetTranslateText(table["tips1_format"]), table["tips1"]); award_desc.Append('\n'); award_desc.AppendFormat(xc.TextHelper.GetTranslateText(table["tips2_format"]), table["tips2"]); award_desc.Append('\n'); award_desc.AppendFormat(xc.TextHelper.GetTranslateText(table["tips3_format"]), table["tips3"]); contentstr = award_desc.ToString(); } } Text title = UIHelper.FindChild(m_MonsterInfo, "TitleText").GetComponent <Text>(); Text content = UIHelper.FindChild(m_MonsterInfo, "Content").GetComponent <Text>(); title.text = titlestr; content.text = contentstr; GameObject monster_point; if (mMonsterListPointObjs.TryGetValue(mCurrentMonsterInfo.Id, out monster_point)) { m_MonsterInfo.transform.localPosition = GetTipsPos(monster_point); float y = mMapScroll.viewport.rect.height / 2 - monster_point.transform.localPosition.y; float x = mMapScroll.viewport.rect.width / 2 - monster_point.transform.localPosition.x; mMiniMapRawImage.rectTransform.anchoredPosition = new Vector2(x, y); } }
private void InitBtnInfo() { List <PoolObjHandle <ActorRoot> > list = ActorHelper.FilterActors(Singleton <GameObjMgr> .instance.HeroActors, new ActorFilterDelegate(Singleton <BattleLogic> .instance.FilterEnemyActor)); this.m_iCurEnemyPlayerCount = list.get_Count(); if (this.m_iCurEnemyPlayerCount > 5) { this.m_iCurEnemyPlayerCount = 5; } CEnemyHeroAtkBtn.m_UI3DCamera = Singleton <Camera_UI3D> .GetInstance().GetCurrentCamera(); this.m_ui3dRes = Singleton <CGameObjectPool> .GetInstance().GetGameObject("Prefab_Skill_Effects/Common_Effects/EnemyHeroAttack", enResourceType.BattleScene); float num = 1f; if (Singleton <CBattleSystem> .instance.FightFormScript != null) { num = Singleton <CBattleSystem> .instance.FightFormScript.GetScreenScaleValue(); } if (this.m_ui3dRes != null) { this.m_ui3dRes.transform.SetParent(CEnemyHeroAtkBtn.m_UI3DCamera.transform, true); if (this.m_objSelectedImg == null) { this.m_objSelectedImg = this.m_ui3dRes.transform.FindChild("selected").gameObject; if (this.m_objSelectedImg) { Sprite3D component = this.m_objSelectedImg.GetComponent <Sprite3D>(); if (component) { component.width *= num; component.height *= num; } this.m_objDirection = this.m_objSelectedImg.transform.FindChild("direction").gameObject; if (this.m_objDirection) { Vector3 position = this.m_objDirection.transform.position; position.y *= num; this.m_objDirection.transform.position = position; component = this.m_objDirection.GetComponent <Sprite3D>(); if (component) { component.width *= num; component.height *= num; } } } } if (this.m_attackLinker == null) { this.m_objLinker = this.m_ui3dRes.transform.FindChild("linker").gameObject; if (this.m_objLinker) { this.m_attackLinker = this.m_objLinker.GetComponent <LineRenderer>(); if (this.m_attackLinker != null && CEnemyHeroAtkBtn.m_UI3DCamera) { this.m_attackLinker.SetVertexCount(2); this.m_attackLinker.useWorldSpace = true; } } } } for (int i = 0; i < this.m_iCurEnemyPlayerCount; i++) { Transform transform = this.m_objPanelEnemyHeroAtk.transform.FindChild(CEnemyHeroAtkBtn.m_arrHeroBtnNames[i]); string heroSkinPic = CSkinInfo.GetHeroSkinPic((uint)list.get_Item(i).handle.TheActorMeta.ConfigId, 0u); string prefabPath = CUIUtility.s_Sprite_Dynamic_BustCircle_Dir + heroSkinPic; Image component2 = transform.GetComponent <Image>(); if (component2) { component2.SetSprite(prefabPath, Singleton <CBattleSystem> .GetInstance().FormScript, true, false, false, false); } if (this.m_ui3dRes != null) { GameObject gameObject = this.m_ui3dRes.transform.FindChild("hp_" + i).gameObject; if (gameObject) { Sprite3D component3 = gameObject.GetComponent <Sprite3D>(); if (component3) { component3.width *= num; component3.height *= num; } GameObject gameObject2 = gameObject.transform.FindChild("hp").gameObject; if (gameObject2) { Sprite3D component4 = gameObject2.GetComponent <Sprite3D>(); component4.width *= num; component4.height *= num; this.m_arrBtnInfo[i] = new CEnemyHeroAtkBtn.BTN_INFO(transform, list.get_Item(i), CEnemyHeroAtkBtn.ENM_ENEMY_HERO_STATE.ENM_ENEMY_HERO_STATE_TOOFAR, true, gameObject, component4); } } } } }