Exemplo n.º 1
0
 private void OnWeightChanged()
 {
     if (this.entity.IsAttached())
     {
         for (int i = 0; i < base.state.NewProperty.Length; i++)
         {
             for (int j = 0; j < base.state.NewProperty[i].Items.Length; j++)
             {
                 if (base.state.NewProperty[i].Items[j] != this.Doors[i]._slots[j].StoredItemId)
                 {
                     if (this.Doors[i]._slots[j]._removed)
                     {
                         this.Doors[i]._slots[j]._removed = false;
                         AddItemToDoor addItemToDoor = AddItemToDoor.Create(GlobalTargets.OnlyServer);
                         addItemToDoor.Door = i;
                         addItemToDoor.Slot = j;
                         addItemToDoor.Item = -1;
                         addItemToDoor.Send();
                     }
                     else if (this.Doors[i]._slots[j]._added)
                     {
                         this.Doors[i]._slots[j]._added = false;
                         AddItemToDoor addItemToDoor2 = AddItemToDoor.Create(GlobalTargets.OnlyServer);
                         addItemToDoor2.Door = i;
                         addItemToDoor2.Slot = j;
                         addItemToDoor2.Item = this.Doors[i]._slots[j].StoredItemId;
                         addItemToDoor2.Send();
                     }
                     this._lastSend = Time.time;
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
    private IEnumerator LoadSaveRoutine()
    {
        yield return(null);

        yield return(null);

        for (int i = 0; i < base.state.NewProperty.Length; i++)
        {
            int num = Mathf.Min(base.state.NewProperty[i].Items.Length, this.Doors[i]._slots.Length);
            for (int j = 0; j < num; j++)
            {
                if (base.state.NewProperty[i].Items[j] != this.Doors[i]._slots[j].StoredItemId)
                {
                    this.Doors[i]._slots[j].Added = false;
                    AddItemToDoor addItemToDoor = AddItemToDoor.Create(GlobalTargets.OnlyServer);
                    addItemToDoor.Door = i;
                    addItemToDoor.Slot = j;
                    addItemToDoor.Item = this.Doors[i]._slots[j].StoredItemId;
                    addItemToDoor.Send();
                }
            }
        }
        yield break;
    }