public static Actionbar DeserializeActionbar(ActionBarData actionBarData) { var actionbar = new Actionbar(GlobalGameSettings.PLAYER_ACTION_BAR_SIZE); foreach (ActionItemStructure actionItem in actionBarData.Items) { actionbar.AddItemAt((ActionItemType)actionItem.Type, actionItem.ItemId, actionItem.Index); } return(actionbar); }
public static void add(GameObject obj) { int slot = 1; newPickup = true; while (slot <= 6) { if (items[slot - 1] == null) { Actionbar.assign(obj, slot); slot = 10; } slot++; } itemPickup = obj; }
public static ActionBarData SerializeActionbar(Actionbar actionbar) { var items = new int[actionbar.FilledSlots]; var slots = actionbar.GetSlots().ToArray(); for (byte i = 0, slotCounter = 0; i < slots.Length; i++) { var slot = slots[i]; if (slot.IsEmpty) { continue; } var item = slot.Item; items[slotCounter++] = (int)new ActionItemStructure(item.ItemId, (byte)item.Type, i); } return(new ActionBarData { Items = items }); }
void Awake() { actionbar = GetComponent <Actionbar>(); SetValue(); }
public void Set(Actionbar value) { Array.Copy(value.data, 0, data, 0, value.data.Length); onChanged?.Invoke(data); }