public void SetDisplayState(ToolbarState state) { if (toolbarState != state) { toolbarState = state; RedrawToolbar(); } }
void Start() { toolbarState = GameObject.FindObjectOfType <ToolbarState>(); projectionScreenState = GameObject.FindObjectOfType <ProjectionScreenState>(); addButton = gameObject.GetComponentInChildren <Button>(); buttonText = addButton.GetComponentInChildren <Text>(); canvasRaycaster = gameObject.GetComponentInParent <GraphicRaycaster>(); events = gameObject.GetComponentInParent <EventSystem>(); interactionColor = new Color(buttonText.color.r, buttonText.color.g, buttonText.color.b); activeColor = new Color(buttonText.color.r, buttonText.color.g, buttonText.color.b, 0.6f); buttonText.text = "New Todo"; }
static Toolbars() { EntryTypes = typeof(ToolbarEntry).GetConstructableChildren(); CMOptions = new ToolbarsOptions(); Profiles = new BinaryDataStore<PlayerMobile, ToolbarState>(VitaNexCore.SavesDirectory + "/Toolbars", "States") { Async = true, OnSerialize = Serialize, OnDeserialize = Deserialize }; DefaultEntries = new ToolbarState(null, CMOptions.DefaultWidth, CMOptions.DefaultHeight); }
private static void ClearDefaults() { DefaultEntries = new ToolbarState(null, CMOptions.DefaultWidth, CMOptions.DefaultHeight); }
public static ToolbarState EnsureState(PlayerMobile user) { if (Profiles.ContainsKey(user)) { if (Profiles[user] == null) { Profiles[user] = new ToolbarState(user); Profiles[user].SetDefaultEntries(); } } else { var state = new ToolbarState(user); state.SetDefaultEntries(); Profiles.Add(user, state); } return Profiles[user]; }
public static bool Deserialize(GenericReader reader) { var version = reader.GetVersion(); switch (version) { case 0: { if (reader.ReadBool()) { if (DefaultEntries != null) { DefaultEntries.Deserialize(reader); } else { DefaultEntries = new ToolbarState(reader); } } reader.ReadBlockDictionary( r => { var k = r.ReadMobile<PlayerMobile>(); var v = new ToolbarState(r); return new KeyValuePair<PlayerMobile, ToolbarState>(k, v); }, Profiles); } break; } return true; }