Exemplo n.º 1
0
 private void UnBindModAsProxy(ref ItemRepresentation.ItemModPair pair)
 {
     if ((int)pair.bindState == 2)
     {
         pair.dataBlock.UnBindAsProxy(pair.representation);
         pair.bindState = ItemRepresentation.BindState.None;
     }
 }
Exemplo n.º 2
0
 private void BindModAsProxy(ref ItemRepresentation.ItemModPair pair)
 {
     if ((int)pair.bindState == 1)
     {
         pair.dataBlock.BindAsProxy(pair.representation);
         pair.bindState = ItemRepresentation.BindState.World;
     }
 }
Exemplo n.º 3
0
 private void UnBindModAsLocal(ref ItemRepresentation.ItemModPair pair, ref ModViewModelRemoveArgs a)
 {
     if ((int)pair.bindState == 3)
     {
         a.modRep = pair.representation;
         pair.dataBlock.UnBindAsLocal(ref a);
         pair.bindState = ItemRepresentation.BindState.None;
     }
 }
Exemplo n.º 4
0
 private static bool KillModForRep(ref ItemRepresentation.ItemModPair pair, ItemModRepresentation modRep, ItemRepresentation owner, bool fromCallback)
 {
     if (pair.representation != modRep)
     {
         return(true);
     }
     owner.KillModRep(ref pair.representation, fromCallback);
     return(true);
 }
Exemplo n.º 5
0
 private void BindModAsLocal(ref ItemRepresentation.ItemModPair pair, ref ModViewModelAddArgs a)
 {
     if ((int)pair.bindState == 2)
     {
         this.UnBindModAsProxy(ref pair);
     }
     if ((int)pair.bindState == 1 || (int)pair.bindState == 3)
     {
         a.modRep = pair.representation;
         pair.dataBlock.BindAsLocal(ref a);
         pair.bindState = ItemRepresentation.BindState.Local;
     }
 }
Exemplo n.º 6
0
    protected virtual void StateSignalReceive(Character character, bool treatedAsFirst)
    {
        CharacterStateFlags characterStateFlag = character.stateFlags;

        if (this.lastCharacterStateFlags.HasValue && this.lastCharacterStateFlags.Value.Equals(characterStateFlag))
        {
            return;
        }
        this.lastCharacterStateFlags = new CharacterStateFlags?(characterStateFlag);
        for (int i = 0; i < 5; i++)
        {
            if (this._itemMods[i].representation)
            {
                ItemRepresentation.ItemModPair item = this._itemMods[i];
                item.representation.HandleChangedStateFlags(characterStateFlag, !treatedAsFirst);
            }
        }
    }
Exemplo n.º 7
0
 private void InstallMod(ref ItemRepresentation.ItemModPair to, int slot, ItemModDataBlock datablock, CharacterStateFlags flags)
 {
     to.dataBlock = datablock;
     if (to.representation)
     {
         this.KillModRep(ref to.representation, false);
     }
     if (to.dataBlock.hasModRepresentation && to.dataBlock.AddModRepresentationComponent(base.gameObject, out to.representation))
     {
         to.bindState = ItemRepresentation.BindState.None;
         to.representation.Initialize(this, slot, flags);
         if (!to.representation)
         {
             to.bindState      = ItemRepresentation.BindState.Vacant;
             to.representation = null;
         }
         else if (this.worldModels)
         {
             this._itemMods.BindAsProxy(slot, this);
         }
     }
 }
Exemplo n.º 8
0
        public ItemRepresentation.ItemModPair this[int slotNumber]
        {
            get
            {
                switch (slotNumber)
                {
                case 0:
                {
                    return(this.a);
                }

                case 1:
                {
                    return(this.b);
                }

                case 2:
                {
                    return(this.c);
                }

                case 3:
                {
                    return(this.d);
                }

                case 4:
                {
                    return(this.e);
                }
                }
                throw new IndexOutOfRangeException();
            }
            set
            {
                switch (slotNumber)
                {
                case 0:
                {
                    this.a = value;
                    break;
                }

                case 1:
                {
                    this.b = value;
                    break;
                }

                case 2:
                {
                    this.c = value;
                    break;
                }

                case 3:
                {
                    this.d = value;
                    break;
                }

                case 4:
                {
                    this.e = value;
                    break;
                }

                default:
                {
                    throw new IndexOutOfRangeException();
                }
                }
            }
        }
Exemplo n.º 9
0
 private void ClearModPair(ref ItemRepresentation.ItemModPair pair)
 {
     this.KillModRep(ref pair.representation, false);
     this.EraseModDatablock(ref pair.dataBlock);
     pair = new ItemRepresentation.ItemModPair();
 }