private static Vector2 GetAnchor(PartyIdx idx)
 {
     switch (idx)
     {
         case PartyIdx._1:
             return new Vector2(AnchorXStart, AnchorY);
         case PartyIdx._2:
             return new Vector2(AnchorXStart + AnchorXInterval, AnchorY);
         case PartyIdx._3:
             return new Vector2(AnchorXStart + AnchorXInterval*2, AnchorY);
         default:
             Debug.Assert(false, LogMessages.EnumUndefined(idx));
             return Vector2.zero;
     }
 }
            public PartyMember this[PartyIdx idx]
            {
                get
                {
                    switch (idx)
                    {
                        case PartyIdx._1:
                            return _1;
                        case PartyIdx._2:
                            return _2;
                        case PartyIdx._3:
                            return _3;
                    }

                    Debug.Assert(false, LogMessages.EnumUndefined(idx));
                    return null;
                }

                set
                {
                    switch (idx)
                    {
                        case PartyIdx._1:
                            _1 = value;
                            return;
                        case PartyIdx._2:
                            _2 = value;
                            return;
                        case PartyIdx._3:
                            _3 = value;
                            return;
                    }

                    Debug.Assert(false, LogMessages.EnumUndefined(idx));
                }
            }
        private PartyIdx[] GetRotatedOrder(PartyIdx idx, PartyIdx to)
        {
            var ret = new PartyIdx[_entries.Count];
            var min = idx < to ? idx : to;
            var max = idx > to ? idx : to;

            foreach (var entry in _entries)
            {
                var entryIdx = entry.Idx;
                var arrayIdx = entryIdx.ToArrayIndex();

                if (entryIdx < min || entryIdx > max)
                {
                    ret[arrayIdx] = entryIdx;
                }
                else if (entryIdx != idx)
                {
                    if (idx < to)
                        ret[arrayIdx] = entryIdx - 1;
                    else
                        ret[arrayIdx] = entryIdx + 1;
                }
                else
                {
                    ret[arrayIdx] = to;
                }
            }

            return ret;
        }
 public void JustSetIdx(PartyIdx idx)
 {
     UnregisterPartyCallback(_idx);
     _idx = idx;
     RegisterPartyCallback(_idx);
 }
 void UnregisterPartyCallback(PartyIdx idx)
 {
     _party.GetOnAdd(idx).Value -= OnPartyAdded;
     _party.GetOnRemove(idx).Value -= OnPartyRemoved;
 }
 private void OnRemove(PartyIdx idx, CharacterId id)
 {
     this[idx].RemoveCharacter();
 }
 public CargoEntry this[PartyIdx idx]
 {
     get { return _entries[idx.ToArrayIndex()]; }
 }