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.
38 lines
1.1 KiB
38 lines
1.1 KiB
3 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
namespace ET
|
||
|
{
|
||
|
public static class GmHelper
|
||
|
{
|
||
|
public static async ETTask<int> AddItem(Unit unit, List<int> Ks, List<int> Vs)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
M2C_GMAddItem resp =
|
||
|
await unit.ZoneScene().GetComponent<SessionComponent>().Session.Call(new C2M_GMAddItem() { Ks = Ks, Vs = Vs }) as
|
||
|
M2C_GMAddItem;
|
||
|
if (resp.Error != ErrorCode.ERR_Success)
|
||
|
{
|
||
|
Log.Error(resp.Error.ToString());
|
||
|
return resp.Error;
|
||
|
}
|
||
|
|
||
|
var storeNc = unit.GetComponent<StoreComponent>();
|
||
|
for (int i = 0; i < Ks.Count; i++)
|
||
|
{
|
||
|
storeNc.Add(Ks[i], Vs[i]);
|
||
|
}
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
Console.WriteLine(e);
|
||
|
throw;
|
||
|
}
|
||
|
|
||
|
await ETTask.CompletedTask;
|
||
|
return ErrorCode.ERR_Success;
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|