zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0

替换var语法

develope
Cal 2021-04-11 19:50:39 +08:00
parent 9818b1307d
commit b2ee0a38be
793 changed files with 35676 additions and 25634 deletions

View File

@ -377,6 +377,9 @@ II.2.12 <HandlesEvent />
<s:Int64 x:Key="/Default/Environment/Hierarchy/GeneratedFilesCacheKey/Timestamp/@EntryValue">79</s:Int64>
<s:Boolean x:Key="/Default/Environment/Hierarchy/NuGetOptions/GlobalEnabled/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/Hierarchy/NuGetOptions/IncludePrerelease/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/Environment/InlayHints/CppParameterNameHintsOptions2/ShowParameterNameHints/@EntryValue">Never</s:String>
<s:String x:Key="/Default/Environment/InlayHints/CSharpParameterNameHintsOptions/ShowParameterNameHints/@EntryValue">Never</s:String>
<s:String x:Key="/Default/Environment/InlayHints/VBParameterNameHintsOptions/ShowParameterNameHints/@EntryValue">Never</s:String>
@ -399,6 +402,9 @@ II.2.12 &lt;HandlesEvent /&gt;&#xD;
<s:Boolean x:Key="/Default/Environment/SearchAndNavigation/AutoExpandResults/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SearchAndNavigation/MergeOccurences/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SearchAndNavigation/OpenPreviewTabForSelectedItemInFindResults/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECpp_002EDaemon_002EInlayHints_002EParameterHints_002ECppParameterNameHintsOptionsOptionsMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECSharp_002EParameterNameHints_002ECSharpParameterNameHintsOptionsMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002EVB_002EParameterNameHints_002EVBParameterNameHintsOptionsMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpFileLayoutPatternsUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>

View File

@ -26,7 +26,7 @@
<component id="n11_eh2a" name="btn" src="eh2a1s" fileName="MainUI/ButtonHeadInfo.xml" xy="15,2" size="59,67" alpha="0">
<relation target="" sidePair="width-width%,height-height%,center-center%,middle-middle%"/>
</component>
<list id="n13_f4pr" name="listBuff" xy="45,70" size="145,73" layout="flow_hz" overflow="hidden" scroll="horizontal" lineGap="5" colGap="3" defaultItem="ui://kqsmrpxlgc4sutma">
<list id="n13_f4pr" name="listBuff" xy="45,70" size="145,73" layout="flow_hz" overflow="hidden" scroll="horizontal" lineGap="5" colGap="3" defaultItem="ui://kqsmrpxlgc4sutma" autoClearItems="true">
<item/>
<item/>
<item/>

Binary file not shown.

View File

@ -1,10 +1,8 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\86155\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\86155\\.nuget\\packages",
"D:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages",
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
"C:\\Users\\Cal\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\Cal\\.nuget\\packages"
]
}
}

View File

@ -2746,4 +2746,9 @@ message M2C_SyncPet // IActorMessage
string name =5;
bool isShow =6;
int64 UnitId = 7;
}
message C2M_ShowPet // IActorLocationMessage
{
int32 RpcId = 90;
int64 ActorId = 93;
}

Binary file not shown.

View File

@ -1,10 +1,8 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\86155\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\86155\\.nuget\\packages",
"D:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages",
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
"C:\\Users\\Cal\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\Cal\\.nuget\\packages"
]
}
}

View File

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Net;
namespace ET
@ -46,7 +47,7 @@ namespace ET
var processScenes = StartSceneConfigCategory.Instance.GetByProcess(Game.Options.Process);
List<StartSceneConfig> processScenes = StartSceneConfigCategory.Instance.GetByProcess(Game.Options.Process);
foreach (StartSceneConfig startConfig in processScenes)
{
Scene scene = await SceneFactory.Create(Game.Scene, startConfig.SceneId, startConfig.Zone, startConfig.Name, startConfig.Type, startConfig);

View File

@ -9,12 +9,12 @@ namespace ET
public static void Broadcast(IEnumerable<Unit> mineTeam, IEnumerable<Unit> targetTeam, IActorMessage message)
{
if (mineTeam != null)
foreach (var unit in mineTeam)
foreach (Unit unit in mineTeam)
{
SendActor(unit, message);
}
if (targetTeam != null)
foreach (var unit in targetTeam)
foreach (Unit unit in targetTeam)
{
SendActor(unit, message);
}
@ -51,7 +51,7 @@ namespace ET
{
return;
}
var gate = unit.GetComponent<UserGateComponent>();
UserGateComponent gate = unit.GetComponent<UserGateComponent>();
if (gate == null) return;
SendActor(unit.GetComponent<UserGateComponent>().GateSessionActorId, message);
}

View File

@ -19,7 +19,7 @@ namespace ET
{
while (true)
{
var ret = await TimerComponent.Instance.WaitAsync(1000, cancelToken);
bool ret = await TimerComponent.Instance.WaitAsync(1000, cancelToken);
if (!ret) return;
if (AppConfig.inst.isTest)
Log.Info($"【{UserComponent.Instance.Get(unit.Id)?.NickName} ({unit.Id})】回城");

View File

@ -23,7 +23,7 @@ namespace ET
while (true)
{
NPCBase nPCBase = NPCBaseCategory.Instance.Get(NPCBaseId.);
var targetPos = new Vector2(nPCBase.PosX, nPCBase.PosY);
Vector2 targetPos = new Vector2(nPCBase.PosX, nPCBase.PosY);
if (AppConfig.inst.isTest)
Log.Info($"【{UserComponent.Instance.Get(unit.Id)?.NickName} ({unit.Id})】移动到商人");
bool ret = await MoveHelper.MoveTo(unit, targetPos, cancelToken); // 移动到目标点, 返回false表示协程取消

View File

@ -12,7 +12,7 @@ namespace ET
{
if (unit.IsTeamLeader)
return false;
var leader = MapUnitComponent.Instance.Get(unit.TeamLeaderId);
Unit leader = MapUnitComponent.Instance.Get(unit.TeamLeaderId);
if (!leader)
return false;
UnitScene unitScene = leader.GetComponent<UnitScene>();
@ -27,17 +27,17 @@ namespace ET
{
if (AppConfig.inst.isTest)
Log.Info($"【{UserComponent.Instance.Get(unit.Id)?.NickName} ({unit.Id})】跟随队长");
var leader = MapUnitComponent.Instance.Get(unit.TeamLeaderId);
Unit leader = MapUnitComponent.Instance.Get(unit.TeamLeaderId);
if (!leader)
return;
UnitScene unitScene = unit.GetComponent<UnitScene>();
UnitScene leaderUnitScene = leader.GetComponent<UnitScene>();
var target = leaderUnitScene.targetPos;
Vector2 target = leaderUnitScene.targetPos;
Vector2 delta = CalucateDistanceXandY(unitScene.Position, target);
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
int index = team.GetIndex(unit.Id);
Vector2 targetPos = new(target.x - delta.x * index, target.y - delta.y * index);
var ret = await MoveHelper.MoveTo(unit, targetPos, cancelToken); // 移动到目标点, 返回false表示协程取消
bool ret = await MoveHelper.MoveTo(unit, targetPos, cancelToken); // 移动到目标点, 返回false表示协程取消
if (!ret) return;
ret = await TimerComponent.Instance.WaitAsync(300, cancelToken);
if (!ret) return;

View File

@ -16,7 +16,7 @@ namespace ET
{
while (true)
{
var ret = await TimerComponent.Instance.WaitAsync(1000, cancelToken);
bool ret = await TimerComponent.Instance.WaitAsync(1000, cancelToken);
if (!ret) return;
}
}

View File

@ -14,10 +14,10 @@ namespace ET
base.unit = unit;
base.unitId = unit.Id;
GoodsBase = goodsBase;
var now = TimeHelper.ClientNow();
long now = TimeHelper.ClientNow();
BuffEndTime = now + GoodsBase.ContinuedSeconds;
GoodsEffectComponent.Instance.AddGoodsBuff(unit.Id,GoodsEffectType.AddBattleExpSpeed,this);
var data = unit.GetComponent<PlayerData>();
PlayerData data = unit.GetComponent<PlayerData>();
data.BattleExpSpeed = GoodsBase.ExpRange;
data.battleExpSpeedLeastTime = now + GoodsBase.ContinuedSeconds;
BuffState = BuffState.Running;

View File

@ -17,8 +17,8 @@ namespace ET
private string Run()
{
var data = unit.GetComponent<PlayerData>();
var num = unit.GetComponent<NumericComponent>();
PlayerData data = unit.GetComponent<PlayerData>();
NumericComponent num = unit.GetComponent<NumericComponent>();
int energy = num.GetAsInt(NumericType.Energy);
energy += GoodsBase.CommonIncrease;
if (energy > Energy_Limit)

View File

@ -27,7 +27,7 @@ namespace ET
{
for (int i = 0; i < GoodsBase.EquipBySpecialArr.Length; i++)
{
var equip = GoodsBase.EquipBySpecialArr[i];
GoodsBase.EquipBySpecial equip = GoodsBase.EquipBySpecialArr[i];
if (equip.EquipBySpecial_MinId == 0 &&
equip.EquipBySpecial_MaxId == 0) continue;
//!通过固定概率选择品质
@ -54,7 +54,7 @@ namespace ET
{
for (int i = 0; i < GoodsBase.MaterialBySpecialArr.Length; i++)
{
var materials = GoodsBase.MaterialBySpecialArr[i];
GoodsBase.MaterialBySpecial materials = GoodsBase.MaterialBySpecialArr[i];
if (materials.MaterialBySpecial_MinId == 0 &&
materials.MaterialBySpecial_MaxId == 0) continue;
//!通过固定概率选择品质
@ -83,7 +83,7 @@ namespace ET
}
}
}
var ret = new M2C_SendBag();
M2C_SendBag ret = new M2C_SendBag();
BagHelper.GetBagInfo(unit, ret.BagMapList);
MessageHelper.SendActor(unit, ret);
}

View File

@ -19,7 +19,7 @@ namespace ET
{
for (int i = 0; i < GoodsBase.EquipArr.Length; i++)
{
var equip = GoodsBase.EquipArr[i];
GoodsBase.Equip equip = GoodsBase.EquipArr[i];
if (equip.Equip_Id == 0) continue;
if (MathHelper.IsHit(equip.Equip_Probability))
{
@ -28,7 +28,7 @@ namespace ET
}
for (int i = 0; i < GoodsBase.GoodsArr.Length; i++)
{
var goods = GoodsBase.GoodsArr[i];
GoodsBase.Goods goods = GoodsBase.GoodsArr[i];
if (goods.Goods_Id == 0) continue;
if (MathHelper.IsHit(goods.Goods_Probability))
{
@ -37,14 +37,14 @@ namespace ET
}
for (int i = 0; i < GoodsBase.MaterialsArr.Length; i++)
{
var materials = GoodsBase.MaterialsArr[i];
GoodsBase.Materials materials = GoodsBase.MaterialsArr[i];
if (materials.Materials_Id == 0) continue;
if (MathHelper.IsHit(materials.Materials_Probability))
{
ItemComponent.Instance.AddItem(unit, materials.Materials_Id, materials.Materials_Count, isLock: IsLock,getSource:GoodsBase.Name);
}
}
var ret = new M2C_SendBag();
M2C_SendBag ret = new M2C_SendBag();
BagHelper.GetBagInfo(unit, ret.BagMapList);
MessageHelper.SendActor(unit, ret);
await ETTask.CompletedTask;

View File

@ -22,7 +22,7 @@ namespace ET
{
return "禁用药水";
}
var num = unit.GetComponent<NumericComponent>();
NumericComponent num = unit.GetComponent<NumericComponent>();
if (num.GetAsInt(NumericType.Hp) >= num.GetAsInt(NumericType.MaxHp))
{
return "Hp已满,无法使用!";

View File

@ -22,7 +22,7 @@ namespace ET
{
return "禁用药水";
}
var num = unit.GetComponent<NumericComponent>();
NumericComponent num = unit.GetComponent<NumericComponent>();
if (num.GetAsInt(NumericType.Hp) >= num.GetAsInt(NumericType.MaxHp) &&
num.GetAsInt(NumericType.Mp) >= num.GetAsInt(NumericType.MaxMp))
{

View File

@ -17,7 +17,7 @@ namespace ET
private string Run()
{
var data = unit.GetComponent<PlayerData>();
PlayerData data = unit.GetComponent<PlayerData>();
data.mainstoryAITime += GoodsBase.CommonIncrease;
UnitHelper.SaveComponenet(data).Coroutine();
return string.Empty;

View File

@ -17,7 +17,7 @@ namespace ET
private string Run()
{
var data = unit.GetComponent<PlayerData>();
PlayerData data = unit.GetComponent<PlayerData>();
data.mainstoryVIPAITime += GoodsBase.CommonIncrease;
UnitHelper.SaveComponenet(data).Coroutine();
return string.Empty;

View File

@ -22,7 +22,7 @@ namespace ET
{
return "禁用药水";
}
var num = unit.GetComponent<NumericComponent>();
NumericComponent num = unit.GetComponent<NumericComponent>();
if(num.GetAsInt(NumericType.Mp) >= num.GetAsInt(NumericType.MaxMp))
{
return "Mp已满,无法使用!";

View File

@ -16,11 +16,11 @@ namespace ET
}
private string Run()
{
var num = unit.GetComponent<NumericComponent>();
NumericComponent num = unit.GetComponent<NumericComponent>();
{
for (int i = 0; i < GoodsBase.GoodsArr.Length; i++)
{
var goods = GoodsBase.GoodsArr[i];
GoodsBase.Goods goods = GoodsBase.GoodsArr[i];
if (goods.Goods_Id == 0) continue;
if (MathHelper.IsHit(goods.Goods_Probability))
{

View File

@ -15,8 +15,8 @@ namespace ET
}
private string Run()
{
var unitSkillComponent = unit.GetComponent<UnitSkillComponent>();
var ret = unitSkillComponent.LearnSkill(GoodsBase.CommonIncrease / 100, GoodsBase.CommonIncrease % 100);
UnitSkillComponent unitSkillComponent = unit.GetComponent<UnitSkillComponent>();
string ret = unitSkillComponent.LearnSkill(GoodsBase.CommonIncrease / 100, GoodsBase.CommonIncrease % 100);
if (!ret.Equals(string.Empty))
{
return ret;

View File

@ -13,13 +13,13 @@ namespace ET
//攻击数值 = 攻击*技能百分比+技能数值威力
//基础伤害=攻击数值*攻击数值/(攻击数值+对方防御)
var def = numTarget.Get(NumericType.PhyDef) + 0.01f;
float def = numTarget.Get(NumericType.PhyDef) + 0.01f;
float mineLevel = numTarget.Get(NumericType.Level);
if (valueCalculate_Self != null)
{
if (SkillHelper.GetParam(valueCalculate_Self.param, skillId, out float percValue1))
{
BattleHelper.GetNumType(valueCalculate_Self, NumTargetType.Self, num, numTarget, out var num1, out var numericType1);
BattleHelper.GetNumType(valueCalculate_Self, NumTargetType.Self, num, numTarget, out NumericComponent num1, out NumericType numericType1);
//攻击能力 = 攻击 * 技能百分比 + 36*力量
float attackValue1 = num1.Get(numericType1) * percValue1 / 100 + ConstDefine.DamageStrTimes*num.Get(NumericType.Str);
//减伤百分比=自身防御/(攻击方等级X200+自身防御);
@ -33,14 +33,14 @@ namespace ET
{
if (SkillHelper.GetParam(valueCalculate_Target.param, skillId, out float percValue2))
{
BattleHelper.GetNumType(valueCalculate_Target, NumTargetType.Target, num, numTarget, out var num2, out var numericType2);
BattleHelper.GetNumType(valueCalculate_Target, NumTargetType.Target, num, numTarget, out NumericComponent num2, out NumericType numericType2);
float attackValue2 = num2.Get(numericType2) * percValue2 / 100 + ConstDefine.DamageStrTimes * num.Get(NumericType.Str);
float reduce = def / (num.Get(NumericType.Level) * ConstDefine.DamageLevelTimes + def);
baseHurt2 = attackValue2 * (1 - reduce) * (1+num.Get( NumericType.PhyDA) - numTarget.Get(NumericType.Nphyi)) - numTarget.Get(NumericType.Phy) * mineLevel/ConstDefine.DamagePhyTimes - numTarget.Get(NumericType.Sta) *mineLevel/ ConstDefine.DamageStaTimes;
if (baseHurt2 <= 0) baseHurt2 = 0;
}
}
var baseHurt = baseHurt1 + baseHurt2;
float baseHurt = baseHurt1 + baseHurt2;
//!++测试
//data.isCrit = RandomHelper.RandomFloat() <= 0.6f;

View File

@ -18,7 +18,7 @@ namespace ET
{
if (SkillHelper.GetParam(valueCalculate_Self.param, skillId, out float percValue1))
{
BattleHelper.GetNumType(valueCalculate_Self, NumTargetType.Self, num, numTarget, out var num1, out var numericType1);
BattleHelper.GetNumType(valueCalculate_Self, NumTargetType.Self, num, numTarget, out NumericComponent num1, out NumericType numericType1);
float attackValue1 = num1.Get(numericType1) * percValue1 / 100;
baseHurt1 = attackValue1 - numTarget.Get(NumericType.Phy) *mineLevel /ConstDefine.DamagePhyTimes - numTarget.Get(NumericType.Sta) *mineLevel/ ConstDefine.DamageStaTimes;
if (baseHurt1 <= 0) baseHurt1 = 0;
@ -28,13 +28,13 @@ namespace ET
{
if (SkillHelper.GetParam(valueCalculate_Target.param, skillId, out float percValue2))
{
BattleHelper.GetNumType(valueCalculate_Target, NumTargetType.Target, num, numTarget, out var num2, out var numericType2);
BattleHelper.GetNumType(valueCalculate_Target, NumTargetType.Target, num, numTarget, out NumericComponent num2, out NumericType numericType2);
float attackValue2 = num2.Get(numericType2) * percValue2 / 100 ;
baseHurt2 = attackValue2 - numTarget.Get(NumericType.Phy) *mineLevel/ ConstDefine.DamagePhyTimes - numTarget.Get(NumericType.Sta) *mineLevel/ ConstDefine.DamageStaTimes;
if (baseHurt2 <= 0) baseHurt2 = 0;
}
}
var baseHurt = baseHurt1 + baseHurt2;
float baseHurt = baseHurt1 + baseHurt2;
data.isCrit = false;
float criHurt = 1f;

View File

@ -12,13 +12,13 @@ namespace ET
float baseHurt1 = 0, baseHurt2 = 0;
//攻击数值 = 攻击*技能百分比+技能数值威力
//基础伤害=攻击数值*攻击数值/(攻击数值+对方防御)
var def = numTarget.Get(NumericType.SpiDef) + 0.01f;
float def = numTarget.Get(NumericType.SpiDef) + 0.01f;
float mineLevel = numTarget.Get(NumericType.Level);
if (valueCalculate_Self != null)
{
if (SkillHelper.GetParam(valueCalculate_Self.param, skillId, out float percValue1))
{
BattleHelper.GetNumType(valueCalculate_Self, NumTargetType.Self, num, numTarget, out var num1, out var numericType1);
BattleHelper.GetNumType(valueCalculate_Self, NumTargetType.Self, num, numTarget, out NumericComponent num1, out NumericType numericType1);
float attackValue1 = num1.Get(numericType1) * percValue1 / 100 + ConstDefine.DamageStrTimes * num.Get(NumericType.Wim);
//减伤百分比=自身防御/(攻击方等级X200+自身防御);
//最终伤害=对方基础攻击X(1-减伤百分比)*(1-自身减伤百分比)-体力*14-耐力*48
@ -31,14 +31,14 @@ namespace ET
{
if (SkillHelper.GetParam(valueCalculate_Target.param, skillId, out float percValue2))
{
BattleHelper.GetNumType(valueCalculate_Target, NumTargetType.Target, num, numTarget, out var num2, out var numericType2);
BattleHelper.GetNumType(valueCalculate_Target, NumTargetType.Target, num, numTarget, out NumericComponent num2, out NumericType numericType2);
float attackValue2 = num2.Get(numericType2) * percValue2 / 100 + ConstDefine.DamageStrTimes * num.Get(NumericType.Wim);
float reduce = def / (num.Get(NumericType.Level) * ConstDefine.DamageLevelTimes + def);
baseHurt2 = attackValue2 * (1 - reduce) * (1 +num.Get( NumericType.MicDA) - numTarget.Get(NumericType.Nmeni)) - numTarget.Get(NumericType.Phy) *mineLevel/ ConstDefine.DamagePhyTimes - numTarget.Get(NumericType.Sta) * mineLevel/ConstDefine.DamageStaTimes;
if (baseHurt2 <= 0) baseHurt2 = 0;
}
}
var baseHurt = baseHurt1 + baseHurt2;
float baseHurt = baseHurt1 + baseHurt2;
if (num.Parent.GetComponent<ModifierContainerComponent>().HasState(ModifierStateType.))

View File

@ -20,7 +20,7 @@ namespace ET
{
if (SkillHelper.GetParam(valueCalculate_Self.param, skillId, out float percValue1))
{
BattleHelper.GetNumType(valueCalculate_Self, NumTargetType.Self, num, numTarget, out var num1, out var numericType1);
BattleHelper.GetNumType(valueCalculate_Self, NumTargetType.Self, num, numTarget, out NumericComponent num1, out NumericType numericType1);
baseHurt1 = num1.Get(numericType1) * percValue1 / 100;
}
}
@ -28,11 +28,11 @@ namespace ET
{
if (SkillHelper.GetParam(valueCalculate_Target.param, skillId, out float percValue2))
{
BattleHelper.GetNumType(valueCalculate_Target, NumTargetType.Target, num, numTarget, out var num2, out var numericType2);
BattleHelper.GetNumType(valueCalculate_Target, NumTargetType.Target, num, numTarget, out NumericComponent num2, out NumericType numericType2);
baseHurt2 = num2.Get(numericType2) * percValue2 / 100;
}
}
var baseHurt = baseHurt1 + baseHurt2;
float baseHurt = baseHurt1 + baseHurt2;
float phyAtk = num.Get(NumericType.PhyAtk);
float spiAtk = num.Get(NumericType.SpiAtk);

View File

@ -24,7 +24,7 @@ namespace ET
await TimerComponent.Instance.WaitAsync(500);
if (unit.IsTeamLeader)
{
var monster = MapCoinComponent.instance.GetCoinMonster(mapId);
Unit monster = MapCoinComponent.instance.GetCoinMonster(mapId);
if (monster)
{
Game.EventSystem.Publish(new ET.EventType.OnCreateUnit

View File

@ -9,7 +9,7 @@ namespace ET
{
public override async ETTask Run(EventType.BackMainCity args)
{
var unit = args.unit;
Unit unit = args.unit;
if (!unit.IsTeamLeader)
{
MessageHelper.SendActor(unit, new M2C_SendTip() { Message = "您不是队长,无法回城" });
@ -17,8 +17,8 @@ namespace ET
}
bool isInCity = false;
if (unit.GetComponent<UnitScene>().MapId / 100 == Sys_SceneId.Scene_MainCity) isInCity = true;
var targetSceneInfo = MapSceneComponent.Instance.GetMapInfo(Sys_SceneId.Scene_MainCity);
var position = targetSceneInfo.PlayerPosArr[0];
Sys_Scene targetSceneInfo = MapSceneComponent.Instance.GetMapInfo(Sys_SceneId.Scene_MainCity);
Sys_Scene.PlayerPos position = targetSceneInfo.PlayerPosArr[0];
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
if (team == null)
@ -28,7 +28,7 @@ namespace ET
}
if (!args.isForce )
{
var data = unit.GetComponent<PlayerData>();
PlayerData data = unit.GetComponent<PlayerData>();
if(team.TeamState == TeamState.Fight || data.IsBattleIdle)
{
MessageHelper.SendActor(unit, new M2C_SendTip() { Message = "战斗中,无法回城" });
@ -36,9 +36,9 @@ namespace ET
}
}
team.ChangeState(TeamState.Transfer);
using var listComponent = ListComponent<ETTask>.Create();
var teamList = team.GetUnits();
foreach (var item in teamList)
using ListComponent<ETTask> listComponent = ListComponent<ETTask>.Create();
LinkedList<Unit> teamList = team.GetUnits();
foreach (Unit item in teamList)
{
listComponent.List.Add(Transfer(item, new UnityEngine.Vector2(position.PlayerPos_x, position.PlayerPos_y), Sys_SceneId.Scene_MainCity * 100 + 1,isInCity));
}
@ -65,7 +65,7 @@ namespace ET
await ETTaskHelper.WaitAll(listComponent.List);
await TimerComponent.Instance.WaitAsync(1000);
team.ChangeState(TeamState.None);
foreach (var u in teamList)
foreach (Unit u in teamList)
{
u.IsTransfer = false;
}

View File

@ -9,8 +9,8 @@ namespace ET
{
public override async ETTask Run(BattleEnd args)
{
var unit = args.unit;
var team = args.team;
Unit unit = args.unit;
Team team = args.team;
try
{
//清理modifier
@ -23,15 +23,15 @@ namespace ET
}
if (unit.UnitType != UnitType.Player)
return;
var brocastComponent = unit.GetComponent<BrocastComponent>();
var aoi = brocastComponent.GetInternalAll();
using var listComponent = ListComponent<long>.Create();
foreach (var u in aoi)
BrocastComponent brocastComponent = unit.GetComponent<BrocastComponent>();
HashSet<long> aoi = brocastComponent.GetInternalAll();
using ListComponent<long> listComponent = ListComponent<long>.Create();
foreach (long u in aoi)
{
if (!team.Contains(u))
listComponent.List.Add(u);
}
foreach (var item in listComponent.List)
foreach (long item in listComponent.List)
{
brocastComponent.RemoveInternal(item);
Log.Info($"{unit.Id}去除{item}");
@ -44,9 +44,9 @@ namespace ET
{
public override async ETTask Run(EventType.BattleEnd_AddHp args)
{
var unit = args.unit;
Unit unit = args.unit;
PlayerData data = unit.GetComponent<PlayerData>();
var num = unit.GetComponent<NumericComponent>();
NumericComponent num = unit.GetComponent<NumericComponent>();
AddHp(num, data);
AddMp(num, data);
UnitHelper.SaveComponenet(data).Coroutine();
@ -56,7 +56,7 @@ namespace ET
private void AddHp(NumericComponent num, PlayerData data)
{
var hpKV = data.hpAutoFullCapatial;
KeyValuePair<int, int> hpKV = data.hpAutoFullCapatial;
int hp = MathHelper.RoundToInt(hpKV.Value / 10000f * num.GetAsInt(NumericType.MaxHp)) - num.GetAsInt(NumericType.Hp);
if (hp < 0) hp = 0;
int capacity = hpKV.Key;
@ -74,7 +74,7 @@ namespace ET
}
private void AddMp(NumericComponent num, PlayerData data)
{
var hpKV = data.mpAutoFullCapatial;
KeyValuePair<int, int> hpKV = data.mpAutoFullCapatial;
int mp = MathHelper.RoundToInt(hpKV.Value / 10000f * num.GetAsInt(NumericType.MaxMp) - num.GetAsInt(NumericType.Mp));
if (mp < 0) mp = 0;
int capacity = hpKV.Key;
@ -101,23 +101,23 @@ namespace ET
private const float TeamLeaderAddExp = 1.2f;
public override async ETTask Run(EventType.BattleEnd_Reword args)
{
var unit = args.unit;
var rewordMap = args.rewordMap;
var battleType = args.battleType;
Unit unit = args.unit;
UnOrderMultiMap<long, (int, int)> rewordMap = args.rewordMap;
BattleType battleType = args.battleType;
if (unit.UnitType != UnitType.Player)
return;
try
{
var playerData = unit.GetComponent<PlayerData>();
var now = TimeHelper.ClientNow();
PlayerData playerData = unit.GetComponent<PlayerData>();
long now = TimeHelper.ClientNow();
if (playerData.BattleExpSpeed != 1 && playerData.battleExpSpeedLeastTime < now)
{
playerData.BattleExpSpeed = 1;
UnitHelper.Save<PlayerData>(unit).Coroutine();
}
var battleInteractiveInfo = MainStoryMap.Instance.GetBattleInteractiveInfo(unit.TeamLeaderId);
MainStoryInteractive battleInteractiveInfo = MainStoryMap.Instance.GetBattleInteractiveInfo(unit.TeamLeaderId);
int monsterId = battleInteractiveInfo.LeaderMonsterId;
//!不触发奖励
if (monsterId == 0) return;
@ -163,7 +163,7 @@ namespace ET
//队长
float drop = 1;
float expAddtion = 1, coinAddtion = 1;
var playerData = unit.GetComponent<PlayerData>();
PlayerData playerData = unit.GetComponent<PlayerData>();
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
if (unit.IsTeamLeader && team.MemberCount > 1) expAddtion *= TeamLeaderAddExp;
int addtionIndex = team.MemberCount - 1;
@ -178,7 +178,7 @@ namespace ET
MainStory mainStory = MainStoryCategory.Instance.Get(configid);
if (mainStory != null && mainStory.Layer != 10) expAddtion /= 5f;
var num = unit.GetComponent<NumericComponent>();
NumericComponent num = unit.GetComponent<NumericComponent>();
if (!unit.IsAlive)
{
expAddtion *= 0.5f;
@ -190,7 +190,7 @@ namespace ET
if (drop != 0)
{
var rewardRet = Drop(unit, playerData, BattleType.MainStory, monsterBase.Dropasubset, rewordMap, drop, "主线掉落" );
M2C_SendReward rewardRet = Drop(unit, playerData, BattleType.MainStory, monsterBase.Dropasubset, rewordMap, drop, "主线掉落" );
SendMessage(unit, num, rewardRet, exp, 0);
}
@ -206,9 +206,9 @@ namespace ET
return;
}
float expAddtion = 1;
var playerData = unit.GetComponent<PlayerData>();
PlayerData playerData = unit.GetComponent<PlayerData>();
float drop = 1;
var num = unit.GetComponent<NumericComponent>();
NumericComponent num = unit.GetComponent<NumericComponent>();
if (!unit.IsAlive)
{
expAddtion *= 0.5f;
@ -220,7 +220,7 @@ namespace ET
if (drop != 0)
{
var rewardRet = Drop(unit, playerData, BattleType.TrialCopy, monsterBase.Dropasubset, rewordMap, drop, "试炼掉落");
M2C_SendReward rewardRet = Drop(unit, playerData, BattleType.TrialCopy, monsterBase.Dropasubset, rewordMap, drop, "试炼掉落");
SendMessage(unit, num, rewardRet, exp, 0);
}
@ -238,7 +238,7 @@ namespace ET
}
float expAddtion = 1, coinAddtion = 1;
float reduceDrop = 0.2f;
var playerData = unit.GetComponent<PlayerData>();
PlayerData playerData = unit.GetComponent<PlayerData>();
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
int addtionIndex = team.MemberCount - 1;
expAddtion += expAddtionArr[addtionIndex];
@ -252,7 +252,7 @@ namespace ET
float reduce = 0.7f;
expAddtion *= reduce;
var num = unit.GetComponent<NumericComponent>();
NumericComponent num = unit.GetComponent<NumericComponent>();
if (!unit.IsAlive)
{
expAddtion *= 0.2f;
@ -304,13 +304,13 @@ namespace ET
if (!unit.IsAlive)
expAddtion /= 2;
var num = unit.GetComponent<NumericComponent>();
var playerData = unit.GetComponent<PlayerData>();
NumericComponent num = unit.GetComponent<NumericComponent>();
PlayerData playerData = unit.GetComponent<PlayerData>();
//!Exp
long exp = MathHelper.RoundToLong(monsterBase.Exp * playerData.BattleExpSpeed * expAddtion);
num.AddSet(NumericType.Exp, exp);
var rewardRet = Drop(unit, playerData, BattleType.Boss, monsterBase.Dropasubset, rewordMap, 1, "Boss掉落");
M2C_SendReward rewardRet = Drop(unit, playerData, BattleType.Boss, monsterBase.Dropasubset, rewordMap, 1, "Boss掉落");
SendMessage(unit, num, rewardRet, exp, 0);
}
private async ETTask ManulEquipReward(Unit unit, int monsterId, UnOrderMultiMap<long, (int, int)> rewordMap)
@ -328,22 +328,22 @@ namespace ET
{
reduceDrop *= 0.3f;
}
var num = unit.GetComponent<NumericComponent>();
var playerData = unit.GetComponent<PlayerData>();
NumericComponent num = unit.GetComponent<NumericComponent>();
PlayerData playerData = unit.GetComponent<PlayerData>();
var rewardRet = Drop(unit, playerData, BattleType.ManulEquip, manulEquipMonsterConfig.Dropasubset, rewordMap, reduceDrop, "手工副本掉落", true);
M2C_SendReward rewardRet = Drop(unit, playerData, BattleType.ManulEquip, manulEquipMonsterConfig.Dropasubset, rewordMap, reduceDrop, "手工副本掉落", true);
SendMessage(unit, num, rewardRet, 0, 0);
}
private M2C_SendReward Drop(Unit unit, PlayerData playerData, BattleType battleType, int parentId, UnOrderMultiMap<long, (int, int)> rewordMap, float dropProperbility, string getSource, bool isLock = false)
{
try
{
var rewardRet = new M2C_SendReward();
M2C_SendReward rewardRet = new M2C_SendReward();
if (parentId == 0) return rewardRet;
Parentset parentSet = ParentsetCategory.Instance.Get(parentId);
foreach (var subSet in parentSet.SubsetArr)
foreach (Parentset.Subset subSet in parentSet.SubsetArr)
{
var sonSetId = playerData.UpdateDrop(subSet._Id);
int sonSetId = playerData.UpdateDrop(subSet._Id);
SonSet sonSet = SonSetCategory.Instance.Get(sonSetId);
(int itemId, int itemCount) = GetItemFormSet(sonSet.DropArr, dropProperbility, false);
if (itemId == 0) continue;
@ -401,7 +401,7 @@ namespace ET
private static (int, int) GetItemFormSet(SonSet.Drop[] arr, float damagePercent, bool isKilled)
{
using var listComponent = ListComponent<int>.Create();
using ListComponent<int> listComponent = ListComponent<int>.Create();
List<int> weightList = listComponent.List;
foreach (SonSet.Drop drop in arr)
{
@ -415,13 +415,13 @@ namespace ET
weightList.Add(drop.Weight);
}
int index = MathHelper.GetProbabilityIndexByWeight(weightList);
var item = arr[index];
SonSet.Drop item = arr[index];
return (item._Id, RandomHelper.RandomNumber(item.MinCount, item.MaxCount + 1));
}
private void SendMessage(Unit unit, NumericComponent num, M2C_SendReward rewardRet, long exp, long coin)
{
var bagRet = new M2C_SendBag();
M2C_SendBag bagRet = new M2C_SendBag();
BagHelper.GetBagInfo(unit, bagRet.BagMapList);
MessageHelper.SendActor(unit, bagRet);
//!发送奖励信息

View File

@ -9,7 +9,7 @@ namespace ET
{
public override async ETTask Run(EventType.BattleSkillRet args)
{
var unit = args.targetUnit;
Unit unit = args.targetUnit;
M2C_BattleSkillRet skillRet = new M2C_BattleSkillRet()
{
UnitId = args.targetUnit.Id,

View File

@ -8,13 +8,13 @@ namespace ET
{
public override async ETTask Run(EventType.BattleStart args)
{
var teamList = args.teamList;
var targetTeamList = args.targetTeamList;
IEnumerable<Unit> teamList = args.teamList;
IEnumerable<Unit> targetTeamList = args.targetTeamList;
int index = 0;
foreach (var unit in teamList)
foreach (Unit unit in teamList)
{
unit.GetComponent<Position>().pos = index++;
var brocastComponent = unit.GetComponent<BrocastComponent>();
BrocastComponent brocastComponent = unit.GetComponent<BrocastComponent>();
brocastComponent.ClearInternal();
brocastComponent.AddInternal(teamList);
if (args.isPvp)
@ -22,10 +22,10 @@ namespace ET
CheckState(unit);
}
index = 0;
foreach (var unit in targetTeamList)
foreach (Unit unit in targetTeamList)
{
unit.GetOrAddComponent<Position>().pos = index++;
var brocastComponent = unit.GetComponent<BrocastComponent>();
BrocastComponent brocastComponent = unit.GetComponent<BrocastComponent>();
brocastComponent.ClearInternal();
brocastComponent.AddInternal(teamList);
@ -42,7 +42,7 @@ namespace ET
private static void CheckState(Unit unit)
{
unit.Stop();
var num = unit.GetComponent<NumericComponent>();
NumericComponent num = unit.GetComponent<NumericComponent>();
if (!unit.IsAlive)
{
Log.Error($"玩家{unit.Id} name={ UserComponent.Instance.Get(unit.Id)?.NickName}已经死亡");
@ -55,7 +55,7 @@ namespace ET
}
if (unit.UnitType == UnitType.Player)
CharacterHelper.ResetAddNumeric(unit, num);
var skillAi = unit.GetComponent<SkillAI>();
SkillAI skillAi = unit.GetComponent<SkillAI>();
skillAi.roundCD = CharacterHelper.GetSkillCD(num.Get(NumericType.Spd));
if (AppConfig.inst.showBattleSkillInfo)
Log.Info($"【{ UserComponent.Instance.Get(unit.Id)?.NickName} ({ unit.Id})】cd = {skillAi.roundCD}");
@ -66,7 +66,7 @@ namespace ET
if (unit.GetComponent<UnitEnermy>() == null)
unit.AddComponent<UnitEnermy>();
var modifierCatainarComponent = unit.GetComponent<ModifierContainerComponent>();
ModifierContainerComponent modifierCatainarComponent = unit.GetComponent<ModifierContainerComponent>();
if (modifierCatainarComponent == null)
{
Log.Error($"modifierCatainarComponent == null where id ={unit.Id}");

View File

@ -9,7 +9,7 @@ namespace ET
public override async ETTask Run(BuffStateRet args)
{
var unit = args.targetUnit;
Unit unit = args.targetUnit;
M2C_BattleChangeState changeHp = new M2C_BattleChangeState()
{
Id=args.Id,

View File

@ -10,8 +10,8 @@ namespace ET
{
try
{
var attacker = args.attacker;
var battleBase = BattleMgrCompnent.Instance.GetBattle(attacker);
Unit attacker = args.attacker;
BattleBase battleBase = BattleMgrCompnent.Instance.GetBattle(attacker);
if (battleBase == null)
{
Log.Error($"battleBase is null");

View File

@ -9,7 +9,7 @@ namespace ET
public override async ETTask Run(TouchBuffStateRet args)
{
var unit = args.targetUnit;
Unit unit = args.targetUnit;
M2C_BattleTouchState changeHp = new M2C_BattleTouchState()
{
UnitId = args.targetUnit.Id,

View File

@ -10,8 +10,8 @@ namespace ET
{
try
{
var attacker = args.attacker;
var battleBase = BattleMgrCompnent.Instance.GetBattle(attacker);
Unit attacker = args.attacker;
BattleBase battleBase = BattleMgrCompnent.Instance.GetBattle(attacker);
if (battleBase == null)
{
Log.Error($"battleBase is null");

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
namespace ET
{
@ -11,7 +12,7 @@ namespace ET
/// <returns></returns>
public override async ETTask Run(EventType.ChangeBattleCharacter args)
{
var unit = args.unit;
Unit unit = args.unit;
MessageHelper.SendActor(unit, new M2C_SendCharacter()
{
Id = unit.Id,
@ -29,8 +30,8 @@ namespace ET
/// <returns></returns>
public override async ETTask Run(EventType.ChangeUnitCharacter args)
{
var unit = args.unit;
var sendUnitInfo = new M2C_SendUnitInfo() { UnitCharacter =await CharacterHelper.GetUnitCharacter(unit) };
Unit unit = args.unit;
M2C_SendUnitInfo sendUnitInfo = new M2C_SendUnitInfo() { UnitCharacter =await CharacterHelper.GetUnitCharacter(unit) };
unit.GetComponent<BrocastComponent>().BrocastInterval(sendUnitInfo);
await ETTask.CompletedTask;
}
@ -49,14 +50,14 @@ namespace ET
Team team = args.team;
Team targetTeam = args.targetTeam;
M2C_SendUnitInfoList m2C_SendUnitInfoList = new M2C_SendUnitInfoList();
var teamList = team.GetUnits();
var targetTeamList = targetTeam.GetUnits();
foreach (var u in teamList)
LinkedList<Unit> teamList = team.GetUnits();
LinkedList<Unit> targetTeamList = targetTeam.GetUnits();
foreach (Unit u in teamList)
{
m2C_SendUnitInfoList.UnitCharacterList.Add(await CharacterHelper.GetUnitCharacter(u));
}
foreach (var u in targetTeamList)
foreach (Unit u in targetTeamList)
{
m2C_SendUnitInfoList.UnitCharacterList.Add(await CharacterHelper.GetUnitCharacter(u));
}

View File

@ -21,8 +21,8 @@ namespace ET
UnitScene _unitScene = unit.GetComponent<UnitScene>();
var targetSceneInfo = MapSceneComponent.Instance.GetMapInfo(mapId / 100);
var position = targetSceneInfo.PlayerPosArr[0];
Sys_Scene targetSceneInfo = MapSceneComponent.Instance.GetMapInfo(mapId / 100);
Sys_Scene.PlayerPos position = targetSceneInfo.PlayerPosArr[0];
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
if (team == null)
@ -31,9 +31,9 @@ namespace ET
return;
}
team.ChangeState(TeamState.Transfer);
using var listComponent = ListComponent<ETTask>.Create();
var teamList = team.GetUnits();
foreach (var item in teamList)
using ListComponent<ETTask> listComponent = ListComponent<ETTask>.Create();
LinkedList<Unit> teamList = team.GetUnits();
foreach (Unit item in teamList)
{
listComponent.List.Add( Transfer(item,new UnityEngine.Vector2(position.PlayerPos_x, position.PlayerPos_y),mapId));
}
@ -62,7 +62,7 @@ namespace ET
await ETTaskHelper.WaitAll(listComponent.List);
await TimerComponent.Instance.WaitAsync(1000);
team.ChangeState(TeamState.None);
foreach (var u in teamList)
foreach (Unit u in teamList)
{
u.IsTransfer = false;
}

View File

@ -11,8 +11,8 @@ namespace ET
{
try
{
var arr = OnLineComponent.Instance.GetAll();
foreach (var session in arr)
IEnumerable<Session> arr = OnLineComponent.Instance.GetAll();
foreach (Session session in arr)
{
MessageHelper.SendActor(session.InstanceId, new M2C_SendTip { Message = "服务器维护中,您已经被强制下线" });
await TimerComponent.Instance.WaitAsync(100);

View File

@ -9,14 +9,14 @@ namespace ET
{
public override async ETTask Run(EventType.CompleteTask args)
{
var unit = args.unit;
var taskBase = args.taskBase;
var indexList = args.indexList;
Unit unit = args.unit;
TaskBase taskBase = args.taskBase;
List<int> indexList = args.indexList;
//!发送奖励信息
for (int i = 0; i < taskBase.RewardArr.Length; i++)
{
if (indexList.Count!=0 && !indexList.Contains(i)) continue;
var reward = taskBase.RewardArr[i];
TaskBase.Reward reward = taskBase.RewardArr[i];
BagHelper.AddItem(unit, reward.Reward_Id, reward.Reward_Count, true, getSource: "任务奖励");
}

View File

@ -8,7 +8,7 @@ namespace ET
{
public override async ETTask Run(EventType.MonsterDead args)
{
var unit = args.unit;
Unit unit = args.unit;
await ETTask.CompletedTask;
}

View File

@ -16,7 +16,7 @@ namespace ET
ConfigId=args.configId,
MapMonsterType = (int)args.monsterType
};
var unit = MapUnitComponent.Instance.Get(args.Actor_UnitId);
Unit unit = MapUnitComponent.Instance.Get(args.Actor_UnitId);
unit.GetComponent<BrocastComponent>().BrocastInterval(pproto);
await ETTask.CompletedTask;
}

View File

@ -12,7 +12,7 @@ namespace ET
{
Id = args.unitId
};
var unit = MapUnitComponent.Instance.Get(args.Actor_UnitId);
Unit unit = MapUnitComponent.Instance.Get(args.Actor_UnitId);
unit.GetComponent<BrocastComponent>().BrocastInterval(pproto);
await ETTask.CompletedTask;
}

View File

@ -8,7 +8,7 @@ namespace ET
{
public override async ETTask Run(OnEnterMap args)
{
var unit = args.unit;
Unit unit = args.unit;
if (unit)
{
//await StoreComponent.Instance.SetOpenRemoteStore(unit,false);

View File

@ -8,7 +8,7 @@ namespace ET
{
public override async ETTask Run(EventType.PlayerDead args)
{
var unit = args.unit;
Unit unit = args.unit;
await ETTask.CompletedTask;

View File

@ -11,7 +11,7 @@ namespace ET
{
string ip = args.remoteIp;
ForbiddenIP forbiddenIP;
var list = await DBComponent.Instance.QueryFilter(Builders<ForbiddenIP>.Filter.Eq(t => t.Ip, ip));
List<ForbiddenIP> list = await DBComponent.Instance.QueryFilter(Builders<ForbiddenIP>.Filter.Eq(t => t.Ip, ip));
if(list ==null || list.Count == 0)
{
forbiddenIP = EntityFactory.Create<ForbiddenIP>(Game.Scene);
@ -24,7 +24,7 @@ namespace ET
forbiddenIP.count++;
await DBComponent.Instance.Save(forbiddenIP);
//!检查所有帐号
var accountList = await DBComponent.Instance.QueryFilter(Builders<Account>.Filter.Or(
List<Account> accountList = await DBComponent.Instance.QueryFilter(Builders<Account>.Filter.Or(
Builders<Account>.Filter.Eq(t => t.CreateIp, ip),
Builders<Account>.Filter.Eq(t => t.LastIp, ip)
));

View File

@ -22,7 +22,7 @@ namespace ET
break;
case ChatType.Normal:
{
foreach (var unit in MapSceneComponent.Instance.GetMap(sender).GetAll())
foreach (Unit unit in MapSceneComponent.Instance.GetMap(sender).GetAll())
{
if (unit.Id == sender.Id)
{
@ -41,7 +41,7 @@ namespace ET
case ChatType.Team:
{
Team team = TeamComponent.Instance.Get(sender.TeamLeaderId);
foreach (var unit in team.GetUnits())
foreach (Unit unit in team.GetUnits())
{
if (unit.Id == sender.Id)
{
@ -59,7 +59,7 @@ namespace ET
break;
case ChatType.World:
{
foreach (var unit in MapUnitComponent.Instance.GetAll())
foreach (Unit unit in MapUnitComponent.Instance.GetAll())
{
if (unit.Id == sender.Id)
{
@ -80,7 +80,7 @@ namespace ET
User user = await UserComponent.Instance.Query(sender.Id);
Family family =await FamilyComponent.Instance.Query(user.Family);
if (family == null) return;
foreach (var familyMemberId in family.GetAllId())
foreach (long familyMemberId in family.GetAllId())
{
if (familyMemberId == sender.Id)
{

View File

@ -8,8 +8,8 @@ namespace ET
{
public override async ETTask Run(SyncAttribute args)
{
var unit = args.unit;
var syncUnitAttribute = new M2C_SyncUnitAttribute { UnitId = unit.Id, NumericType = args.numericType, Value = args.value };
Unit unit = args.unit;
M2C_SyncUnitAttribute syncUnitAttribute = new M2C_SyncUnitAttribute { UnitId = unit.Id, NumericType = args.numericType, Value = args.value };
unit.GetComponent<BrocastComponent>()?.BrocastInterval(syncUnitAttribute);
await ETTask.CompletedTask;
}

View File

@ -8,9 +8,9 @@ namespace ET
{
public override async ETTask Run(EventType.UpdatePer30MinuteOfDay args)
{
var list = await DBComponent.Instance.Query<User>(u => u.Level >= 500);
List<User> list = await DBComponent.Instance.Query<User>(u => u.Level >= 500);
if (list == null || list.Count == 0) return;
foreach (var user in list)
foreach (User user in list)
{
try
{

View File

@ -10,7 +10,7 @@ namespace ET
{
try
{
var unit = args.unit;
Unit unit = args.unit;
Log.Debug($"玩家Id=【{unit.Id}】下线开始");
User user = UserComponent.Instance.Get(unit.Id);
//保存玩家单位
@ -41,10 +41,10 @@ namespace ET
try
{
//销毁之前保存buff
var lib = await BuffLibComponent.Instance.Query(unit.Id);
var goodsBuffList = GoodsEffectComponent.Instance.GetAllEffect(unit.Id);
BuffLib lib = await BuffLibComponent.Instance.Query(unit.Id);
IEnumerable<GoodsEffect> goodsBuffList = GoodsEffectComponent.Instance.GetAllEffect(unit.Id);
if (goodsBuffList != null)
foreach (var item in goodsBuffList)
foreach (GoodsEffect item in goodsBuffList)
{
//!排除非时间性goodsBuff效果
if (item.BuffEndTime != 0)

View File

@ -8,7 +8,7 @@ namespace ET
{
public override async ETTask Run(UpdateAutoSkillList args)
{
var skillAI = args.skillAI;
SkillAI skillAI = args.skillAI;
skillAI.UpdateAutoSkill();
await ETTask.CompletedTask;
}

View File

@ -10,8 +10,8 @@ namespace ET
{
public override async ETTask Run(UpdatePer1MinuteOfDay args)
{
var now = args.now;
foreach (var unit in MapUnitComponent.Instance.GetAll())
long now = args.now;
foreach (Unit unit in MapUnitComponent.Instance.GetAll())
{
try
{
@ -33,11 +33,11 @@ namespace ET
if (unitScene.MapId/100 == Sys_SceneId.Scene_MainCity)
{
int maxSceneId = data.MainStoryRecordId;
var mainStoryExp = MainStoryExpCategory.Instance.Get(maxSceneId);
MainStoryExp mainStoryExp = MainStoryExpCategory.Instance.Get(maxSceneId);
CharacterHelper.AddExp(unit, MathHelper.RoundToLong(mainStoryExp.Exp/30f));
}
var time = TimeSpan.FromMilliseconds(data.OnlineTime);
TimeSpan time = TimeSpan.FromMilliseconds(data.OnlineTime);
if(AppConfig.inst.isTest)
Log.Debug($"【{ UserComponent.Instance.Get(unit.Id)?.NickName} ({ unit.Id})】在线时间:{time}");
}
@ -53,15 +53,15 @@ namespace ET
{
public override async ETTask Run(UpdatePer1MinuteOfDay args)
{
var now = args.now;
long now = args.now;
//!dTime =59s
//long dTime = TimeSpan.TicksPerMinute / 10000 - 1000;
var arr = MapUnitComponent.Instance.GetAll().ToArray();
Unit[] arr = MapUnitComponent.Instance.GetAll().ToArray();
for (int i = 0; i < arr.Length; i++)
{
try
{
var unit = arr[i];
Unit unit = arr[i];
if (!unit) continue;
if (unit.UnitType != UnitType.Player)
continue;
@ -84,12 +84,12 @@ namespace ET
Log.Error(e);
}
}
var userArr = UserComponent.Instance.GetAll().ToArray();
User[] userArr = UserComponent.Instance.GetAll().ToArray();
for (int i = 0; i < userArr.Length; i++)
{
try
{
var user = userArr[i];
User user = userArr[i];
await DBComponent.Instance.Save(user);
}
catch (Exception e)

View File

@ -11,17 +11,17 @@ namespace ET
try
{
var unit = args.unit;
Unit unit = args.unit;
if (!unit)
{
Log.Error($"unit is invalid where unitId = {unit.Id}");
return;
}
var unitTask = unit.GetComponent<UnitTask>();
UnitTask unitTask = unit.GetComponent<UnitTask>();
if (!unitTask)
return;
var type = args.type;
var value = args.value;
TaskTargetType type = args.type;
int value = args.value;
switch (type)
{
case TaskTargetType.KillSpecialTask:
@ -32,15 +32,15 @@ namespace ET
{
try
{
var task = unitTask.RunningTaskList[ii];
Task task = unitTask.RunningTaskList[ii];
if (task.TaskTargetType == type)
{
int taskId = (int)task.Id;
var taskbase = DataTableHelper.Get<TaskBase>(taskId);
TaskBase taskbase = DataTableHelper.Get<TaskBase>(taskId);
if (taskbase == null) Log.Error($"taskBase ==null where id = {taskId}");
for (int i = 0; i < taskbase.CountTargetArr.Length; i++)
{
var countTarget = taskbase.CountTargetArr[i];
TaskBase.CountTarget countTarget = taskbase.CountTargetArr[i];
if (countTarget.CountTarget_Id == value)
{
task.UpdateAmount(i);
@ -62,17 +62,17 @@ namespace ET
case TaskTargetType.KillAnyTask:
//!value:怪物Id
int level = unit.GetComponent<NumericComponent>().GetAsInt(NumericType.Level);
var monsterBase = DataTableHelper.Get<MonsterBase>(value);
MonsterBase monsterBase = DataTableHelper.Get<MonsterBase>(value);
if (monsterBase == null) return;
for (int i = 0; i < unitTask.RunningTaskList.Count; i++)
{
try
{
var task = unitTask.RunningTaskList[i];
Task task = unitTask.RunningTaskList[i];
if (task.TaskTargetType == type)
{
int taskId = (int)task.Id;
var taskbase = DataTableHelper.Get<TaskBase>(taskId);
TaskBase taskbase = DataTableHelper.Get<TaskBase>(taskId);
if (taskbase == null) Log.Error($"taskBase==null where id = {taskId}");
if (level- monsterBase.Level <= taskbase.AnyTargetLevel)
task.UpdateAmount(0);
@ -95,11 +95,11 @@ namespace ET
{
try
{
var task = unitTask.RunningTaskList[i];
Task task = unitTask.RunningTaskList[i];
if (task.TaskTargetType == type)
{
int taskId = (int)task.Id;
var taskbase = DataTableHelper.Get<TaskBase>(taskId);
TaskBase taskbase = DataTableHelper.Get<TaskBase>(taskId);
if (taskbase == null) Log.Error($"taskBase==null where id = {taskId}");
if (value == taskbase.DialogTargetId)
task.UpdateAmount(0);
@ -123,11 +123,11 @@ namespace ET
try
{
var task = unitTask.RunningTaskList[i];
Task task = unitTask.RunningTaskList[i];
if (task.TaskTargetType == type)
{
int taskId = (int)task.Id;
var taskbase = DataTableHelper.Get<TaskBase>(taskId);
TaskBase taskbase = DataTableHelper.Get<TaskBase>(taskId);
if (taskbase == null) Log.Error($"taskBase==null where id = {taskId}");
if (value >= taskbase.TargetLevel)
task.UpdateAmount(0);
@ -150,11 +150,11 @@ namespace ET
try
{
var task = unitTask.RunningTaskList[i];
Task task = unitTask.RunningTaskList[i];
if (task.TaskTargetType == type)
{
int taskId = (int)task.Id;
var taskbase = DataTableHelper.Get<TaskBase>(taskId);
TaskBase taskbase = DataTableHelper.Get<TaskBase>(taskId);
if (taskbase == null) Log.Error($"taskBase==null where id = {taskId}");
if (value / 100 == taskbase.TargetSceneId &&
value % 100 == taskbase.TargetMaplayer)
@ -179,11 +179,11 @@ namespace ET
try
{
var task = unitTask.RunningTaskList[i];
Task task = unitTask.RunningTaskList[i];
if (task.TaskTargetType == type)
{
int taskId = (int)task.Id;
var taskbase = DataTableHelper.Get<TaskBase>(taskId);
TaskBase taskbase = DataTableHelper.Get<TaskBase>(taskId);
if (taskbase == null) Log.Error($"taskBase==null where id = {taskId}");
task.UpdateAmount(0);
if (task.IsComplete)

View File

@ -9,7 +9,7 @@ namespace ET
{
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
if (team.TeamState != TeamState.Fight) return;
var battle = BattleMgrCompnent.Instance.GetBattle(unit);
BattleBase battle = BattleMgrCompnent.Instance.GetBattle(unit);
if (battle == null) return;
battle.quitBattleAction?.Invoke(battle,team,unit.Id);
await ETTask.CompletedTask;

View File

@ -8,7 +8,7 @@ namespace ET
protected override async ETTask Run(Unit unit, C2M_SelectEnermy request, M2C_SelectEnermy response, Action reply)
{
var ret = unit.GetComponent<BattleComponent>().SelectedEnermy(request.Id, TeamType.Target);
string ret = unit.GetComponent<BattleComponent>().SelectedEnermy(request.Id, TeamType.Target);
if (ret != null)
{
response.Message = ret;

View File

@ -7,7 +7,7 @@ namespace ET
{
protected override async ETTask Run(Unit unit, C2M_SelectTeamMember request, M2C_SelectTeamMember response, Action reply)
{
var ret = unit.GetComponent<BattleComponent>().SelectedEnermy(request.Id, TeamType.Self);
string ret = unit.GetComponent<BattleComponent>().SelectedEnermy(request.Id, TeamType.Self);
if (ret != null)
{
response.Message = ret;

View File

@ -1,5 +1,6 @@
using Cal.DataTable;
using System;
using System.Collections.Generic;
namespace ET
{
@ -29,7 +30,7 @@ namespace ET
reply();
return;
}
var teamList = team.GetUnits();
LinkedList<Unit> teamList = team.GetUnits();
UnitScene unitScene = unit.GetComponent<UnitScene>();
int sceneId = unitScene.MapId / 100;
if (sceneId != Sys_SceneId.Scene_BattleIdle)
@ -38,7 +39,7 @@ namespace ET
}
BattleIdleMap.Instance.Remove(unit.TeamLeaderId);
await Game.EventSystem.Publish(new EventType.BackMainCity { unit = unit});
foreach (var u in teamList)
foreach (Unit u in teamList)
{
u.GetComponent<PlayerData>().IsBattleIdle = false;
}

View File

@ -1,5 +1,6 @@
using Cal.DataTable;
using System;
using System.Collections.Generic;
namespace ET
{
@ -29,7 +30,7 @@ namespace ET
reply();
return;
}
var teamList = team.GetUnits();
LinkedList<Unit> teamList = team.GetUnits();
UnitScene unitScene = unit.GetComponent<UnitScene>();
int sceneId = unitScene.MapId / 100;
if (sceneId != Sys_SceneId.Scene_MainCity)
@ -39,7 +40,7 @@ namespace ET
return;
}
int targetSceneId = request.SceneId + 10010;
foreach (var u in teamList)
foreach (Unit u in teamList)
{
if (!u.GetComponent<PlayerData>().CanEnterMianStory(targetSceneId - 1))
{
@ -49,7 +50,7 @@ namespace ET
}
}
await Game.EventSystem.Publish(new EventType.ChangeMap { unit = unit, mapId = Sys_SceneId.Scene_BattleIdle*100+1 });
foreach (var u in teamList)
foreach (Unit u in teamList)
{
u.GetComponent<PlayerData>().IsBattleIdle = true;
}

View File

@ -1,6 +1,7 @@
using Cal.DataTable;
using NLog.Internal;
using System;
using System.Collections.Generic;
using System.Text;
namespace ET
@ -13,8 +14,8 @@ namespace ET
{
try
{
var dic = BossComponent.Instance.keyDic;
if (!dic.TryGetValue(unit.Id, out var key))
Dictionary<long, (long, int)> dic = BossComponent.Instance.keyDic;
if (!dic.TryGetValue(unit.Id, out (long, int) key))
{
response.Message = "系统错误";
reply();
@ -22,7 +23,7 @@ namespace ET
}
dic.Remove(unit.Id);
var bytes = BitConverter.GetBytes(request.Key);
byte[] bytes = BitConverter.GetBytes(request.Key);
//bytes = SecurityUtil.Xor(bytes);
Utility.Encryption.GetSelfXorBytes(bytes, CryptionHelper.GetXorKey());
long keyValue = BitConverter.ToInt64(bytes, 0);
@ -36,7 +37,7 @@ namespace ET
}
int bossId = key.Item2;
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
var teamList = team.GetUnits();
LinkedList<Unit> teamList = team.GetUnits();
if (team.TeamState == TeamState.Fight)
{
Log.Error($"*【{ UserComponent.Instance.Get(unit.Id)?.NickName} ({ unit.Id})】多次进行Boss战斗");
@ -53,16 +54,16 @@ namespace ET
reply();
return;
}
var state = BossComponent.Instance.GetState(bossId);
BossComponent.BossState state = BossComponent.Instance.GetState(bossId);
if(state!= BossComponent.BossState.Idle)
{
response.Message = "boss正在挑战中";
reply();
return;
}
foreach (var u in teamList)
foreach (Unit u in teamList)
{
var data = u.GetComponent<PlayerData>();
PlayerData data = u.GetComponent<PlayerData>();
if (data == null)
{
Log.Error($"data == null where id = {u?.Id}");
@ -72,7 +73,7 @@ namespace ET
UnitHelper.SaveComponenet(data).Coroutine();
}
BossComponent.Instance.ChangeState(bossId, BossComponent.BossState.Battle, false);
var battle = BattleMgrCompnent.Instance.CreateBattle<BossBattle>(team);
BossBattle battle = BattleMgrCompnent.Instance.CreateBattle<BossBattle>(team);
battle.Init(unitScene.MapId);
reply();

View File

@ -1,5 +1,6 @@
using Cal.DataTable;
using System;
using System.Collections.Generic;
namespace ET
{
@ -41,7 +42,7 @@ namespace ET
reply();
return;
}
var state = BossComponent.Instance.GetState(mapLayer);
BossComponent.BossState state = BossComponent.Instance.GetState(mapLayer);
if (state == default)
{
Log.Error($"*【{ UserComponent.Instance.Get(unit.Id)?.NickName} ({ unit.Id})】挑战Boss层数{mapLayer}错误");
@ -62,10 +63,10 @@ namespace ET
return;
}
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
var teamList = team.GetUnits();
foreach (var u in teamList)
LinkedList<Unit> teamList = team.GetUnits();
foreach (Unit u in teamList)
{
var data = u.GetComponent<PlayerData>();
PlayerData data = u.GetComponent<PlayerData>();
if (data == null)
{
Log.Error($"data == null where id = {u?.Id}");

View File

@ -1,5 +1,6 @@
using Cal.DataTable;
using System;
using System.Collections.Generic;
using System.Text;
namespace ET
@ -20,7 +21,7 @@ namespace ET
reply();
return;
}
var time = DateTime.UtcNow.Hour;
int time = DateTime.UtcNow.Hour;
if (time > 13 || time < 1)
{
response.Message = "Boss暂未开启请在9:00 ~ 21:00攻打";
@ -35,10 +36,10 @@ namespace ET
reply();
return;
}
var teamList = team.GetUnits();
foreach (var u in teamList)
LinkedList<Unit> teamList = team.GetUnits();
foreach (Unit u in teamList)
{
var data = u.GetComponent<PlayerData>();
PlayerData data = u.GetComponent<PlayerData>();
if (data == null)
{
Log.Error($"data == null where id = {u?.Id}");
@ -52,16 +53,16 @@ namespace ET
}
}
var user = await UserComponent.Instance.Query(unit.Id);
User user = await UserComponent.Instance.Query(unit.Id);
if (string.IsNullOrEmpty(user.Family))
{
response.Message = "您没有家族!";
reply();
return;
}
foreach (var u in teamList)
foreach (Unit u in teamList)
{
var _user = await UserComponent.Instance.Query(unit.Id);
User _user = await UserComponent.Instance.Query(unit.Id);
if (!_user.Family.Equals(user.Family))
{
response.Message = "同一个家族才可组队战斗!";
@ -69,8 +70,8 @@ namespace ET
return;
}
}
var battle = BattleMgrCompnent.Instance.CreateBattle<FamilyBossBattle>(team);
var familyBoss = await FamilyBossComponent.instance.Query(user.Family);
FamilyBossBattle battle = BattleMgrCompnent.Instance.CreateBattle<FamilyBossBattle>(team);
FamilyBoss familyBoss = await FamilyBossComponent.instance.Query(user.Family);
if (familyBoss == null)
{
Log.Error($"familyBoss = null where name = {user.Family}");
@ -90,9 +91,9 @@ namespace ET
reply();
return;
}
foreach (var u in teamList)
foreach (Unit u in teamList)
{
var data = u.GetComponent<PlayerData>();
PlayerData data = u.GetComponent<PlayerData>();
if (data == null)
{
Log.Error($"data == null where id = {u?.Id}");

View File

@ -24,7 +24,7 @@ namespace ET
return;
}
var unitScene = unit.GetComponent<UnitScene>();
UnitScene unitScene = unit.GetComponent<UnitScene>();
if (TimeHelper.ClientNow() - unitScene.enterTime < moveTimeToStartMonster)
{
Log.Error($"*【{ UserComponent.Instance.Get(unit.Id)?.NickName} ({ unit.Id})】挑战主线时间错误,进入了{TimeHelper.ClientNow() - unitScene.enterTime}");
@ -43,7 +43,7 @@ namespace ET
bool isPosWoring = true;
for (int i = 0; i < mainStory.MonsterPosArr.Length; i++)
{
var posInfo = mainStory.MonsterPosArr[i];
MainStory.MonsterPos posInfo = mainStory.MonsterPosArr[i];
if ((unitScene.Position - new UnityEngine.Vector2(posInfo.MonsterPos_X, posInfo.MonsterPos_Y)).sqrMagnitude <= MoveHelper.AtkDis)
{
isPosWoring = false;
@ -64,7 +64,7 @@ namespace ET
reply();
return;
}
var battle= BattleMgrCompnent.Instance.CreateBattle<MainStoryBattle>(team);
MainStoryBattle battle= BattleMgrCompnent.Instance.CreateBattle<MainStoryBattle>(team);
battle.Init(mainStory);
reply();

View File

@ -29,7 +29,7 @@ namespace ET
reply();
return;
}
var unitScene = unit.GetComponent<UnitScene>();
UnitScene unitScene = unit.GetComponent<UnitScene>();
UnitSceneType unitSceneType = MapSceneComponent.Instance.GetUnitSceneType(unitScene.MapId / 100);
if (unitSceneType != UnitSceneType.ManulEquip)
{
@ -38,7 +38,7 @@ namespace ET
reply();
return;
}
if (!ManulEquipMap.instance.mapUnitDic.TryGetValue(unit.Id, out var _unit))
if (!ManulEquipMap.instance.mapUnitDic.TryGetValue(unit.Id, out Unit _unit))
{
response.Message = "您已击杀此领主";
reply();
@ -54,7 +54,7 @@ namespace ET
return;
}
ManulEquipMap.instance.DestoryUnit(unit.Id);
var battle = BattleMgrCompnent.Instance.CreateBattle<ManulEquipBattle>(team);
ManulEquipBattle battle = BattleMgrCompnent.Instance.CreateBattle<ManulEquipBattle>(team);
battle.Init(config);
response.ConfigId = (int)config.Id;

View File

@ -45,7 +45,7 @@ namespace ET
reply();
return;
}
var targetLeader = targetTeam.GetLeader();
Unit targetLeader = targetTeam.GetLeader();
if (targetLeader.isAI)
{
response.Message = "对方跑图中,请勿打扰!";
@ -75,7 +75,7 @@ namespace ET
return;
}
var battle = BattleMgrCompnent.Instance.CreateBattle<PKBattle>(team);
PKBattle battle = BattleMgrCompnent.Instance.CreateBattle<PKBattle>(team);
battle.Init(targetTeam);
reply();

View File

@ -28,8 +28,8 @@ namespace ET
reply();
return;
}
var unitScene = unit.GetComponent<UnitScene>();
var mapType= MapSceneComponent.Instance.GetUnitSceneType(unitScene.MapId / 100);
UnitScene unitScene = unit.GetComponent<UnitScene>();
UnitSceneType mapType= MapSceneComponent.Instance.GetUnitSceneType(unitScene.MapId / 100);
if (mapType != UnitSceneType.Trial)
{
Log.Error($"*【{ UserComponent.Instance.Get(unit.Id)?.NickName} ({ unit.Id})】场景{unitScene.MapId / 100}错误");
@ -37,7 +37,7 @@ namespace ET
reply();
return;
}
var trialCopy = TrialCopyMap.Instance.GetTrialCopyInfo(unitScene.MapId);
TrialCopy trialCopy = TrialCopyMap.Instance.GetTrialCopyInfo(unitScene.MapId);
if (trialCopy == null)
{
Log.Error($"*【{ UserComponent.Instance.Get(unit.Id)?.NickName} ({ unit.Id})】场景{unitScene.MapId}错误");
@ -52,7 +52,7 @@ namespace ET
reply();
return;
}
var battle = BattleMgrCompnent.Instance.CreateBattle<TrialCopyBattle>(team);
TrialCopyBattle battle = BattleMgrCompnent.Instance.CreateBattle<TrialCopyBattle>(team);
battle.Init(trialCopy);
response.TrialCopyId = (int)trialCopy.Id;

View File

@ -20,7 +20,7 @@ namespace ET
reply();
return;
}
var data = unit.GetComponent<PlayerData>();
PlayerData data = unit.GetComponent<PlayerData>();
List<Unit> list = PvpMap.inatance.GetLevelType(data.personalScord) switch
{
PersonalPvpType.Cupper => PvpMap.inatance.matchCupperList,

View File

@ -35,14 +35,14 @@ namespace ET
reply();
return;
}
var canPvp = PvpMap.inatance.CanPvp();
string canPvp = PvpMap.inatance.CanPvp();
if (canPvp != null)
{
response.Message = canPvp;
reply();
return;
}
var ret = PvpMap.inatance.RequestMatch(unit);
string ret = PvpMap.inatance.RequestMatch(unit);
if (ret != null)
{
response.Message = ret;

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ET
@ -16,7 +17,7 @@ namespace ET
return;
}
var userId = scene.GetComponent<GateSessionKeyComponent>().Get(request.Key);
long userId = scene.GetComponent<GateSessionKeyComponent>().Get(request.Key);
if (userId == 0)
{
response.Error = ErrorCode.ERR_ConnectGateKeyError;
@ -24,7 +25,7 @@ namespace ET
reply();
return;
}
var list = await DBComponent.Instance.Query<Account>(t => t.UserId == userId);
List<Account> list = await DBComponent.Instance.Query<Account>(t => t.UserId == userId);
Account account = list[0];
if (account == null)
{
@ -58,7 +59,7 @@ namespace ET
}
if (AppConfig.inst.isHeartBeat)
session.AddComponent<SessionIdleCheckerComponent, int, int, int>(3 * 1000, 5 * 1000, int.MaxValue);
var component = session.AddComponent<SessionPlayerComponent>();
SessionPlayerComponent component = session.AddComponent<SessionPlayerComponent>();
component.User = user;
session.AddComponent<MailBoxComponent, MailboxType>(MailboxType.GateSession);

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Net;
namespace ET
@ -15,7 +16,7 @@ namespace ET
return;
}
var list = await DBComponent.Instance.Query<NickName>(t => t.Nickname == request.Name);
List<NickName> list = await DBComponent.Instance.Query<NickName>(t => t.Nickname == request.Name);
if (list != null && list.Count > 0)
{
@ -24,13 +25,13 @@ namespace ET
return;
}
using (var nickName = EntityFactory.Create<NickName>(Game.Scene))
using (NickName nickName = EntityFactory.Create<NickName>(Game.Scene))
{
nickName.Nickname = request.Name;
await DBComponent.Instance.Save(nickName);
}
var user =await GateUserComponent.Instance.Query(request.PlayerId);
User user =await GateUserComponent.Instance.Query(request.PlayerId);
//!初始化User
user.JobId = request.JobId;
@ -42,7 +43,7 @@ namespace ET
user.hasRole = true;
user.isChangeDB = true;
var component = session.GetComponent<SessionPlayerComponent>();
SessionPlayerComponent component = session.GetComponent<SessionPlayerComponent>();
component.User = user;
await GateUserComponent.Instance.Save(user);

View File

@ -9,7 +9,7 @@ namespace ET
protected override async ETTask Run(Unit unit, C2M_AddMapCoinCount request, M2C_AddMapCoinCount response, Action reply)
{
var ret = CharacterHelper.ReduceMoney(unit, CharacterHelper.MoneyType.Voucher, ConstDefine.AddMapCointPrice);
string ret = CharacterHelper.ReduceMoney(unit, CharacterHelper.MoneyType.Voucher, ConstDefine.AddMapCointPrice);
if (ret != null)
{
response.Message = ret;

View File

@ -1,5 +1,6 @@
using Cal.DataTable;
using System;
using System.Collections.Generic;
namespace ET
{
@ -15,7 +16,7 @@ namespace ET
reply();
return;
}
var unitScene = unit.GetComponent<UnitScene>();
UnitScene unitScene = unit.GetComponent<UnitScene>();
NPCBase nPCBase = DataTableHelper.Get<NPCBase>(request.NPCId);
if (unitScene.MapId != nPCBase.SceneId * 100 + nPCBase.MapLayer)
{
@ -51,14 +52,14 @@ namespace ET
break;
case 1009://寄售
{
var ret = new M2C_OpenConsignmentUI();
M2C_OpenConsignmentUI ret = new M2C_OpenConsignmentUI();
ret.TotalPage = await ConsignmentComponent.Instance.GetConsignmet(unit, ret.ConsignMapList);
MessageHelper.SendActor(unit, ret);
}
break;
case 1010://合成
{
var ret = new M2C_OpenForgeUI();
M2C_OpenForgeUI ret = new M2C_OpenForgeUI();
MessageHelper.SendActor(unit, ret);
}
break;
@ -73,7 +74,7 @@ namespace ET
case 1014://第3层JJ
case 1015://第4层JJ
{
var taskList = TaskComponent.Instance.CanAcceptTask(unit, request.NPCId);
List<NPCTask> taskList = TaskComponent.Instance.CanAcceptTask(unit, request.NPCId);
if (taskList.Count == 0) break;
M2C_OpenTaskUI ret = new M2C_OpenTaskUI();
ret.TaskList.AddRange(taskList);

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Net;
namespace ET
@ -24,9 +25,9 @@ namespace ET
return;
}
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
var list = team.GetUnits();
LinkedList<Unit> list = team.GetUnits();
bool hasCount = false;
foreach (var u in list)
foreach (Unit u in list)
{
PlayerData data = u.GetComponent<PlayerData>();
hasCount = hasCount || data.mapCoinCount > 0;
@ -38,7 +39,7 @@ namespace ET
return;
}
MapCoinComponent.instance.RemoveMonster(unit.Id, unitScene.MapId);
foreach (var u in list)
foreach (Unit u in list)
{
PlayerData data = u.GetComponent<PlayerData>();
if (data.mapCoinCount <= 0) continue;

View File

@ -23,14 +23,14 @@ namespace ET
MoveHelper.MoveTo(unit, target, yAngle).Coroutine();
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
foreach (var item in team.GetUnits())
foreach (Unit item in team.GetUnits())
{
if (item.IsTeamLeader)
continue;
await TimerComponent.Instance.WaitAsync(300);
if (!item)
continue;
var unitScene = item.GetComponent<UnitScene>();
UnitScene unitScene = item.GetComponent<UnitScene>();
Vector2 delta = CalucateDistanceXandY(unitScene.Position, target);
int index = team.GetIndex(item.Id);
Vector2 targetPos = new(target.x - delta.x * index, target.y - delta.y * index);

View File

@ -20,7 +20,7 @@ namespace ET
}
int price = ConstDefine.AddEnergyPriceArr[count];
var num = unit.GetComponent<NumericComponent>();
NumericComponent num = unit.GetComponent<NumericComponent>();
int energy = num.GetAsInt(NumericType.Energy);
if (energy + ConstDefine.AddEnergyPerCount >= ConstDefine.MaxEnergy)
{
@ -29,7 +29,7 @@ namespace ET
return;
}
var ret = CharacterHelper.ReduceMoney(unit, CharacterHelper.MoneyType.Coin, price);
string ret = CharacterHelper.ReduceMoney(unit, CharacterHelper.MoneyType.Coin, price);
if (ret != null)
{
response.Message = ret;

View File

@ -23,8 +23,8 @@ namespace ET
reply();
return;
}
var ai = MainStoryAIComponent.instance.GetAI(unit);
var ret = MainStoryAIComponent.instance.DestoryAI(ai);
MainStoryAI ai = MainStoryAIComponent.instance.GetAI(unit);
bool ret = MainStoryAIComponent.instance.DestoryAI(ai);
if (!ret)
{
response.Message = "结束出错";

View File

@ -8,12 +8,12 @@ namespace ET
protected override async ETTask Run(Unit unit, C2M_GetBuffTime message)
{
string ret = string.Empty;
var data = unit.GetComponent<PlayerData>();
PlayerData data = unit.GetComponent<PlayerData>();
ret += $"血球Buff剩余量{data.hpAutoFullCapatial.Key}";
ret += $"\n蓝球Buff剩余量{data.mpAutoFullCapatial.Key}";
ret += $"\n普通跑图剩余量{TimeSpan.FromMilliseconds(data.mainstoryAITime):dd\\:hh\\:mm\\:ss}";
ret += $"\n畅爽跑图剩余量{TimeSpan.FromMilliseconds(data.mainstoryVIPAITime):dd\\:hh\\:mm\\:ss}";
var now = TimeHelper.ClientNow();
long now = TimeHelper.ClientNow();
long dTime = data.battleExpSpeedLeastTime - now;
if (dTime < 0) dTime = 0;
ret += $"\n{MathHelper.RoundToInt(data.BattleExpSpeed)}倍战斗经验Buff剩余剩余时间{TimeSpan.FromMilliseconds(dTime).TotalMinutes:f2}分钟";

View File

@ -7,7 +7,7 @@ namespace ET
{
protected override async ETTask Run(Unit unit, C2M_GetRanking request, M2C_GetRanking response, Action reply)
{
var ret = await unit.Domain.GetComponent<Ranking>().GetRanking(request.Index,response.RankingInfoList);
string ret = await unit.Domain.GetComponent<Ranking>().GetRanking(request.Index,response.RankingInfoList);
if (!ret.Equals(string.Empty))
{
response.Message = ret;

View File

@ -40,8 +40,8 @@ namespace ET
return;
}
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
var teamList = team.GetUnits();
foreach (var u in teamList)
LinkedList<Unit> teamList = team.GetUnits();
foreach (Unit u in teamList)
{
if (!u.GetComponent<PlayerData>().CanEnterMianStory(targetSceneId - 1))
{
@ -50,7 +50,7 @@ namespace ET
return;
}
}
var ai = MainStoryAIComponent.instance.CreateAI(team,targetSceneId);
MainStoryAI ai = MainStoryAIComponent.instance.CreateAI(team,targetSceneId);
}
catch (Exception e)
{

View File

@ -26,7 +26,7 @@ namespace ET
return;
}
BagHelper.DeleteItem(unit, itemid, 1);
var ret = await CharacterHelper.Transmigration(unit);
string ret = await CharacterHelper.Transmigration(unit);
if (ret != null)
{
response.Message = ret;

View File

@ -0,0 +1,16 @@
using System;
namespace ET
{
[ActorMessageHandler]
public class C2M_ShowPetHandler: AMActorLocationHandler<Unit, C2M_ShowPet>
{
protected override async ETTask Run(Unit unit, C2M_ShowPet message)
{
Pet pet = unit.GetComponent<Pet>();
pet.isShow = !pet.isShow;
Game.EventSystem.Change(pet);
await ETTask.CompletedTask;
}
}
}

View File

@ -29,7 +29,7 @@ namespace ET
team.Remove(request.TargetId);
//创建新队伍
var targetTeam = TeamComponent.Instance.CreateTeam(request.TargetId);
Team targetTeam = TeamComponent.Instance.CreateTeam(request.TargetId);
reply();
TeamHelper.SendTeamMember(targetTeam);

View File

@ -47,7 +47,7 @@ namespace ET
//更新信息
TeamComponent.Instance.Update(unit.TeamLeaderId, team);
MainStoryMap.Instance.UpdateBattleInteractiveInfo(unit.TeamLeaderId, team.LeaderId);
foreach (var item in team.GetUnits())
foreach (Unit item in team.GetUnits())
{
item.TeamLeaderId = request.UnitId;
}

View File

@ -8,7 +8,7 @@ namespace ET
protected override async ETTask Run(Unit unit, C2M_ChangeItemPos request, M2C_ChangeItemPos response, Action reply)
{
Bag bag = unit.GetComponent<Bag>();
var retStr = bag.ChangePos(request.Pos1, request.Pos2);
string retStr = bag.ChangePos(request.Pos1, request.Pos2);
if (retStr == "")
{
BagHelper.GetBagInfo(unit, response.BagMapList);

View File

@ -8,7 +8,7 @@ namespace ET
{
protected override async ETTask Run(Unit unit, C2M_ChargeCoin request,M2C_ChargeCoin response,Action reply)
{
var ret = CharacterHelper.ReduceMoney(unit, CharacterHelper.MoneyType.Gem, request.Gem);
string ret = CharacterHelper.ReduceMoney(unit, CharacterHelper.MoneyType.Gem, request.Gem);
if (ret != null)
{
response.Message = ret;

View File

@ -8,7 +8,7 @@ namespace ET
{
protected override async ETTask Run(Unit unit, C2M_ChargeVoucher request,M2C_ChargeVoucher response,Action reply)
{
var ret = CharacterHelper.ReduceMoney(unit, CharacterHelper.MoneyType.YuanBao, request.YuanBao);
string ret = CharacterHelper.ReduceMoney(unit, CharacterHelper.MoneyType.YuanBao, request.YuanBao);
if (ret != null)
{
response.Message = ret;

View File

@ -7,7 +7,7 @@ namespace ET
{
protected override async ETTask Run(Unit unit, C2M_DeleteItem request, M2C_DeleteItem response, Action reply)
{
var retStr = ItemComponent.Instance.DeleteItem(unit, request.Index, request.Count);
string retStr = ItemComponent.Instance.DeleteItem(unit, request.Index, request.Count);
if (retStr == "")
{
BagHelper.GetBagInfo(unit, response.BagMapList);

View File

@ -36,7 +36,7 @@ namespace ET
return;
}
Bag bag = unit.GetComponent<Bag>();
if (!bag.ItemDic.TryGetValueByKey1(bagIndex, out var item))
if (!bag.ItemDic.TryGetValueByKey1(bagIndex, out Item item))
{
Log.Error($"玩家Id={unit.Id}想要获取Index={bagIndex}的背包信息,存在错误");
response.Message = "系统错误!";

View File

@ -7,7 +7,7 @@ namespace ET
{
protected override async ETTask Run(Unit unit, C2M_ForgeEquip request, M2C_ForgeEquip response, Action reply)
{
var ret = await ItemComponent.Instance.ForgeEquip(unit, request.Id);
string ret = await ItemComponent.Instance.ForgeEquip(unit, request.Id);
if (!ret.Equals(string.Empty))
{
response.Message = ret;

View File

@ -8,7 +8,7 @@ namespace ET
{
protected override async ETTask Run(Unit unit, C2M_MakeMunalEquip request,M2C_MakeMunalEquip response,Action reply)
{
var ret = await ItemComponent.Instance.MakeMunalEquip(unit, (MunalStoneType)request.Type,request.IsRare);
string ret = await ItemComponent.Instance.MakeMunalEquip(unit, (MunalStoneType)request.Type,request.IsRare);
if (ret != null)
{
response.Message = ret;

View File

@ -8,7 +8,7 @@ namespace ET
protected override async ETTask Run(Unit unit, C2M_SortBag request, M2C_SortBag response, Action reply)
{
Bag bag = unit.GetComponent<Bag>();
var retStr = bag.SortBag();
string retStr = bag.SortBag();
if (retStr == "")
{
BagHelper.GetBagInfo(unit, response.BagMapList);

View File

@ -9,7 +9,7 @@ namespace ET
{
Bag bag = unit.GetComponent<Bag>();
var retStr = bag.SplitItem(request.Index, request.Count);
string retStr = bag.SplitItem(request.Index, request.Count);
if (retStr == "")
{
BagHelper.GetBagInfo(unit, response.BagMapList);

View File

@ -7,7 +7,7 @@ namespace ET
{
protected override async ETTask Run(Unit unit, C2M_StrengthEquip request, M2C_StrengthEquip response, Action reply)
{
var retStr =await ItemComponent.Instance.StrangeEquip(unit, request.bagIndex);
(string, bool) retStr =await ItemComponent.Instance.StrangeEquip(unit, request.bagIndex);
if (retStr.Item1!=null)
{
response.Message = retStr.Item1;

View File

@ -7,7 +7,7 @@ namespace ET
{
protected override async ETTask Run(Unit unit, C2M_Upgrade request, M2C_Upgrade response, Action reply)
{
var ret = await ItemComponent.Instance.UpgradeItem(unit, request.Index);
string ret = await ItemComponent.Instance.UpgradeItem(unit, request.Index);
if (!ret.Equals(string.Empty))
{
response.Message = ret;

View File

@ -9,7 +9,7 @@ namespace ET
protected override async ETTask Run(Unit unit, C2M_UseGoods request, M2C_UseGoods response, Action reply)
{
int index = request.Index;
var ret =await ItemComponent.Instance.UseGoods(unit,index: index);
(string, int) ret =await ItemComponent.Instance.UseGoods(unit,index: index);
if (ret.Item1 != null)
{
response.Message = ret.Item1;
@ -17,7 +17,7 @@ namespace ET
return;
}
UserSetting userSetting = unit.GetComponent<UserSetting>();
foreach (var mainUISlot in userSetting.GetMainUISlots())
foreach (MainUISlot mainUISlot in userSetting.GetMainUISlots())
{
if (mainUISlot?.RealId == ret.Item2)
{

View File

@ -26,7 +26,7 @@ namespace ET
reply();
return;
}
var arr = userSetting.GetMainUISlots();
MainUISlot[] arr = userSetting.GetMainUISlots();
if (request.SlotId < 0 || request.SlotId >= arr.Length)
{
Log.Error(new Exception($"*************************************" +
@ -38,7 +38,7 @@ namespace ET
reply();
return;
}
var mainUISlot = arr[request.SlotId];
MainUISlot mainUISlot = arr[request.SlotId];
if (mainUISlot == null)
{
response.Message = "点击了空格子,请拖入技能或者物品!";
@ -53,10 +53,10 @@ namespace ET
return;
}
var ret = (await ItemComponent.Instance.UseGoods(unit, itemId: itemId)).Item1;
string ret = (await ItemComponent.Instance.UseGoods(unit, itemId: itemId)).Item1;
if (ret==null)
{
foreach (var __mainUISlot in userSetting.GetMainUISlots())
foreach (MainUISlot __mainUISlot in userSetting.GetMainUISlots())
{
if (__mainUISlot?.RealId == itemId)
{

View File

@ -15,13 +15,13 @@ namespace ET
reply();
return;
}
var data = unit.GetComponent<PlayerData>();
PlayerData data = unit.GetComponent<PlayerData>();
int totalCount = 0;
foreach (var item in request.PointList)
foreach (int item in request.PointList)
{
totalCount += item;
}
var num = unit.GetComponent<Character>();
Character num = unit.GetComponent<Character>();
//var trans = CharacterHelper.GetTransmigrationByLevel(num.GetAsInt(NumericType.Level));
//if (trans < request.Trans)
//{
@ -30,8 +30,8 @@ namespace ET
// reply();
// return;
//}
var kp = data.CharacterPointKV;
var characterPoint = kp.Key;
KeyValuePair<int, int> kp = data.CharacterPointKV;
int characterPoint = kp.Key;
if (characterPoint < totalCount)
{
response.Message = "加点总数多于属性点,请重新分配!";
@ -40,7 +40,7 @@ namespace ET
}
//!力量 智慧 体质 耐力 敏捷 精神
int index = 0;
foreach (var count in request.PointList)
foreach (int count in request.PointList)
{
AttributeType type = index++
switch
@ -51,7 +51,7 @@ namespace ET
3 => AttributeType.,
4 => AttributeType.,
5 => AttributeType.,
_ => throw new NotImplementedException(),
_ => throw new Exception($"not exist type : {index-1}"),
};
CharacterHelper.AddPoint(num, type, count);
}

View File

@ -7,7 +7,7 @@ namespace ET
{
protected override async ETTask Run(Unit unit, C2M_BuyInConsignment request, M2C_BuyInConsignment response, Action reply)
{
var ret =await ConsignmentComponent.Instance.BuyInConsignment(unit, request.ConsignmentId,request.Pwd);
string ret =await ConsignmentComponent.Instance.BuyInConsignment(unit, request.ConsignmentId,request.Pwd);
if (!ret.Equals(string.Empty))
{
response.Message = ret;

View File

@ -7,7 +7,7 @@ namespace ET
{
protected override async ETTask Run(Unit unit, C2M_PutInConsignment request, M2C_PutInConsignment response, Action reply)
{
var ret =await ConsignmentComponent.Instance.PutInConsignment(unit,request.Index,request.Count,request.Price,request.Pwd);
string ret =await ConsignmentComponent.Instance.PutInConsignment(unit,request.Index,request.Count,request.Price,request.Pwd);
if (!ret.Equals(string.Empty))
{
response.Message = ret;

View File

@ -8,7 +8,7 @@ namespace ET
protected override async ETTask Run(Unit unit, C2M_CrateFamily request, M2C_CrateFamily response, Action reply)
{
response.Info = new FamilyInfo();
var ret =await FamilyComponent.Instance.CreateFamily(unit, request.Name, response.FamilyMemberInfoList,response.Info);
string ret =await FamilyComponent.Instance.CreateFamily(unit, request.Name, response.FamilyMemberInfoList,response.Info);
if (ret != null)
{
response.Message = ret;

Some files were not shown because too many files have changed in this diff Show More