// ------------------------------------------------------------------------------- protected override void ThrottledUpdate() { if (manager == null) { manager = localPlayer.GetComponent <BuffManager>(); } for (int i = 0; i < contentGroup.childCount; i++) { GameObject.Destroy(contentGroup.GetChild(i).gameObject); } foreach (BuffSyncStruct _entry in manager.GetEntries(true, SortOrder.None, category)) { BuffSyncStruct entry = _entry; GameObject prefab = null; if (displayType == DisplayType.Horizontal) { prefab = horizontalSlotPrefab.gameObject; } else if (displayType == DisplayType.Vertical) { prefab = verticalSlotPrefab.gameObject; } else if (displayType == DisplayType.Grid) { prefab = gridSlotPrefab.gameObject; } GameObject go = GameObject.Instantiate(prefab); go.transform.SetParent(contentGroup, false); go.GetComponent <UIPlayerListBuffSlot>().Init(localPlayer, ref entry); } }
public void SaveData_Buff(GameObject player) { connection.Execute("DELETE FROM c2w_buff WHERE owner=?", player.name); BuffManager manager = player.GetComponent <BuffManager>(); List <BuffSyncStruct> list = manager.GetEntries(false); for (int i = 0; i < list.Count; i++) { BuffSyncStruct entry = list[i]; connection.InsertOrReplace(new c2w_buff { owner = player.name, slot = entry.slot, name = entry.name, level = entry.level, state = entry.state, timer = entry.timer }); } }