using System; using System.Collections.Generic; namespace ET { public static class GmHelper { public static async ETTask AddItem(Unit unit, List Ks, List Vs) { try { M2C_GMAddItem resp = await unit.ZoneScene().GetComponent().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(); 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; } } }