Пример #1
0
        /// <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);
        }
Пример #2
0
 /// <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);
 }
Пример #3
0
        // ユニット一覧取得
        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);
            }
        }