Exemplo n.º 1
0
 public void SetDisplayState(ToolbarState state)
 {
     if (toolbarState != state)
     {
         toolbarState = state;
         RedrawToolbar();
     }
 }
Exemplo n.º 2
0
    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";
    }
Exemplo n.º 3
0
		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);
		}
Exemplo n.º 4
0
		private static void ClearDefaults()
		{
			DefaultEntries = new ToolbarState(null, CMOptions.DefaultWidth, CMOptions.DefaultHeight);
		}
Exemplo n.º 5
0
		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];
		}
Exemplo n.º 6
0
		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;
		}