/// <summary> /// 情報複製:編集時のローカル情報に使用します /// </summary> /// <returns></returns> public UnitList Clone() { var data = new UnitItem[items.Count]; for (int i = 0; i < items.Count; i++) { data[i] = JsonUtility.FromJson <UnitItem>(JsonUtility.ToJson(items[i])); } var res = new UnitList(data); return(res); }
/// <summary> /// 比較して、変更があれば(true) /// </summary> /// <param name="units"></param> /// <returns></returns> public bool IsModify(UnitList units) { for (int i = 0; i < items.Count; i++) { if (items[i].name != units.items[i].name) { return(true); } if (!items[i].uniqids.SequenceEqual(units.items[i].uniqids)) { return(true); } } return(false); }
// ユニット一覧取得 public IEnumerator GetUnitList(bool refresh = false) { if (!refresh && UnitList != null) { yield break; } bool wait = true; Protocol.Send(new UnitListSend(), (r) => { UnitList = new UnitList(r.items); wait = false; }); while (wait) { yield return(null); } }