You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.8 KiB
49 lines
1.8 KiB
using System; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using AX.Network.Protocols; |
|
using UnityEngine; |
|
using AX.Serialization; |
|
|
|
public class UPDATE_FIREDEPLOY_EMGINE_SYNC : NetworkMessageBehaviour |
|
{ |
|
protected override void Execute(BinaryMessage message) |
|
{ |
|
var data = message.Body.Deserialize<KeyValuePair<FireCarEngine, Organization>>(); |
|
|
|
if (data.Key != null) |
|
{ |
|
bool isContain = false; |
|
foreach (var item in FireEnginesData.Instance.GetAllCas().Keys) |
|
{ |
|
if (item == data.Value.DisplayName) |
|
{ |
|
isContain = true; |
|
break; |
|
} |
|
} |
|
|
|
if (isContain) |
|
{//防御性判断:看是否包含此key(data.Value.DisplayName) |
|
for (int i = 0; i < FireEnginesData.Instance.GetAllCas()[data.Value.DisplayName].Count; i++) |
|
{ |
|
if (FireEnginesData.Instance.GetAllCas()[data.Value.DisplayName][i].Key.TypeName == data.Key.TypeName) |
|
{ |
|
FireEnginesData.Instance.GetAllCas()[data.Value.DisplayName][i] = |
|
new KeyValuePair<FireCarEngine, int>(FireEnginesData.Instance.GetAllCas()[data.Value.DisplayName][i].Key, |
|
FireEnginesData.Instance.GetAllCas()[data.Value.DisplayName][i].Value - 1); |
|
} |
|
} |
|
} |
|
|
|
} |
|
else |
|
{ |
|
if (FireEnginesData.Instance.GetAllPersons().ContainsKey(data.Value.DisplayName)) |
|
{ |
|
FireEnginesData.Instance.GetAllPersons()[data.Value.DisplayName] = |
|
FireEnginesData.Instance.GetAllPersons()[data.Value.DisplayName] - 1; |
|
} |
|
} |
|
} |
|
}
|
|
|