Browse Source

Merge pull request #172 from shangfengh/new

refactor: 🎨 help Server
tags/0.1.0
TCL GitHub 2 years ago
parent
commit
41c2a7fe79
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 16 deletions
  1. +13
    -0
      logic/GameClass/GameObj/Character/Character.cs
  2. +2
    -1
      logic/GameClass/GameObj/Character/Skill.cs
  3. +6
    -6
      logic/Gaming/Game.cs
  4. +4
    -4
      logic/Gaming/PropManager.cs
  5. +2
    -2
      logic/Preparation/Interface/IOccupation.cs
  6. +2
    -1
      logic/Preparation/Utility/EnumType.cs
  7. +2
    -2
      logic/Server/CopyInfo.cs

+ 13
- 0
logic/GameClass/GameObj/Character/Character.cs View File

@@ -460,6 +460,19 @@ namespace GameClass.GameObj
}
}

public Prop UseProp(PropType propType)
{
lock (gameObjLock)
{
foreach (Prop prop in propInventory)
{
if (prop.GetPropType() == propType)
return prop;
}
return new NullProp();
}
}

/// <summary>
/// 如果indexing==GameData.maxNumOfPropInPropInventory表明道具栏为满
/// </summary>


+ 2
- 1
logic/GameClass/GameObj/Character/Skill.cs View File

@@ -95,7 +95,8 @@ namespace GameClass.GameObj
return ActiveSkillType.UseKnife;
case CanBeginToCharge:
return ActiveSkillType.CanBeginToCharge;
case Teacher:
case Punish:
return ActiveSkillType.Publish;
default:
return ActiveSkillType.Null;
}


+ 6
- 6
logic/Gaming/Game.cs View File

@@ -341,24 +341,24 @@ namespace Gaming
_ = attackManager.Attack(player, angle);
}
}
public void UseProp(long playerID, int indexing)
public void UseProp(long playerID, PropType propType)
{
if (!gameMap.Timer.IsGaming)
return;
Character? player = gameMap.FindPlayer(playerID);
if (player != null)
{
propManager.UseProp(player, indexing);
propManager.UseProp(player, propType);
}
}
public void ThrowProp(long playerID, int indexing)
public void ThrowProp(long playerID, PropType propType)
{
if (!gameMap.Timer.IsGaming)
return;
Character? player = gameMap.FindPlayer(playerID);
if (player != null)
{
propManager.ThrowProp(player, indexing);
propManager.ThrowProp(player, propType);
}
}
public bool PickProp(long playerID, PropType propType = PropType.Null)
@@ -373,14 +373,14 @@ namespace Gaming
return false;
}

public bool UseActiveSkill(long playerID, ActiveSkillType activeSkillType)
public bool UseActiveSkill(long playerID, int skillNum)
{
if (!gameMap.Timer.IsGaming)
return false;
Character? player = gameMap.FindPlayer(playerID);
if (player != null)
{
return skillManager.UseActiveSkill(player, activeSkillType);
return skillManager.UseActiveSkill(player, player.Occupation.ListOfIActiveSkill[skillNum]);
}
else
return false;


+ 4
- 4
logic/Gaming/PropManager.cs View File

@@ -21,11 +21,11 @@ namespace Gaming

private readonly List<XY> availableCellForGenerateProp;

public void UseProp(Character player, int indexing)
public void UseProp(Character player, PropType propType)
{
if (player.IsResetting)
return;
Prop prop = player.UseProp(indexing);
Prop prop = player.UseProp(propType);
switch (prop.GetPropType())
{
case PropType.ShieldOrSpear:
@@ -106,11 +106,11 @@ namespace Gaming
return false;
}

public void ThrowProp(Character player, int indexing)
public void ThrowProp(Character player, PropType propType)
{
if (!gameMap.Timer.IsGaming || player.IsResetting)
return;
Prop prop = player.UseProp(indexing);
Prop prop = player.UseProp(propType);
if (prop.GetPropType() == PropType.Null)
return;



+ 2
- 2
logic/Preparation/Interface/IOccupation.cs View File

@@ -76,7 +76,7 @@ namespace Preparation.Interface

public BulletType InitBullet => BulletType.Null;

public List<ActiveSkillType> ListOfIActiveSkill => new(new ActiveSkillType[] { });
public List<ActiveSkillType> ListOfIActiveSkill => new(new ActiveSkillType[] { ActiveSkillType.Publish });
public List<PassiveSkillType> ListOfIPassiveSkill => new(new PassiveSkillType[] { });

public const int fixSpeed = 0;
@@ -116,7 +116,7 @@ namespace Preparation.Interface

public BulletType InitBullet => BulletType.Null;

public List<ActiveSkillType> ListOfIActiveSkill => new(new ActiveSkillType[] { });
public List<ActiveSkillType> ListOfIActiveSkill => new(new ActiveSkillType[] { ActiveSkillType.CanBeginToCharge });
public List<PassiveSkillType> ListOfIPassiveSkill => new(new PassiveSkillType[] { });

public const int fixSpeed = GameData.basicFixSpeed * 6 / 10;


+ 2
- 1
logic/Preparation/Utility/EnumType.cs View File

@@ -90,7 +90,8 @@ namespace Preparation.Utility
NuclearWeapon = 3,
SuperFast = 4,
UseKnife = 5,
CanBeginToCharge = 6
CanBeginToCharge = 6,
Publish = 7,
}
public enum PassiveSkillType
{


+ 2
- 2
logic/Server/CopyInfo.cs View File

@@ -259,11 +259,11 @@ namespace Server
foreach (var keyValue in player.TimeUntilActiveSkillAvailable)
msg.TrickerMessage.TimeUntilSkillAvailable.Add(keyValue.Value);
for (int i = 0; i < GameData.maxNumOfSkill - player.TimeUntilActiveSkillAvailable.Count(); ++i)
msg.StudentMessage.TimeUntilSkillAvailable.Add(-1);
msg.TrickerMessage.TimeUntilSkillAvailable.Add(-1);

msg.TrickerMessage.Place = ToPlaceType(player.Place);
foreach (var value in player.PropInventory)
msg.StudentMessage.Prop.Add(ToPropType(value.GetPropType()));
msg.TrickerMessage.Prop.Add(ToPropType(value.GetPropType()));

msg.TrickerMessage.TrickerType = ToTrickerType(player.CharacterType);
msg.TrickerMessage.Guid = player.ID;


Loading…
Cancel
Save