Ejemplo n.º 1
0
    public void Load_Scene_Menu_Item(string scene_name)
    {
        // Get all Scenes.
        Scene[] scenes = new Scene[SceneManager.sceneCount];

        Enum.TryParse(scene_name, out Menu_item scene);

        if (scene == Active_Item && Active_Item != Menu_item.Poll_details_single && Active_Item != Menu_item.Events_details)
        {
            return;
        }

        for (int x = 0; x < SceneManager.sceneCount; x++)
        {
            scenes[x] = SceneManager.GetSceneAt(x);
        }

        // Check if scene_name is a Menu_item.
        for (int x = (int)Menu.Menu_item.Home; x <= (int)Menu.Menu_item.Construction; x++)
        {
            if (scene == (Menu.Menu_item)x)
            {
                for (int y = (int)Menu.Menu_item.Home; y <= (int)Menu.Menu_item.Construction; y++)
                {
                    if (y == x)
                    {
                        continue;
                    }

                    for (int z = 0; z < scenes.Length; z++)
                    {
                        if (y == scenes[z].buildIndex)
                        {
                            SceneManager.UnloadSceneAsync(y);
                        }
                    }
                }
                break;
            }
        }

        Prev_Item   = Active_Item;
        Active_Item = scene;

        if (!Active_Item.ToString().Contains(Prev_Item.ToString()))
        {
            modify_Buttons(Prev_Item, change_sprite, false);
        }

        modify_Buttons(Active_Item, change_sprite, true);

        SceneManager.LoadSceneAsync(scene.ToString(), LoadSceneMode.Additive);
    }
Ejemplo n.º 2
0
 public void Load_Scene_Menu_Item(Menu_item scene)
 {
     Load_Scene_Menu_Item(scene.ToString());
 }
Ejemplo n.º 3
0
    void modify_Buttons(Menu_item menu_item, Action <GameObject, Sprite, Sprite, Sprite, Sprite, bool, bool> method, bool selected)
    {
        switch (menu_item)
        {
        case Menu_item.Home:
            Title_Handler.Singleton.Set_Title();
            method(Button_Home, sprite_selected_home, sprite_unselected_home, null, null, selected, false);
            break;

        case Menu_item.News:
            Title_Handler.Singleton.Set_Title("Noticias");
            method(Button_News, sprite_selected_news, sprite_unselected_news, Sprite_News_Unread_Sel, Sprite_News_Unread, selected, Database_Handler.Unread[typeof(News)]);
            break;

        case Menu_item.News_details:
            Title_Handler.Singleton.Set_Title("Noticias", () => Load_Scene_Menu_Item(Menu_item.News));
            method(Button_News, sprite_selected_news, sprite_unselected_news, Sprite_News_Unread_Sel, Sprite_News_Unread, selected, Database_Handler.Unread[typeof(News)]);
            break;

        case Menu_item.Events:
            Title_Handler.Singleton.Set_Title("Eventos");
            method(Button_Events, sprite_selected_events, sprite_unselected_events, Sprite_Events_Unread_Sel, Sprite_Events_Unread, selected, Database_Handler.Unread[typeof(Calendar_Events)]);
            break;

        case Menu_item.Events_details:
            Title_Handler.Singleton.Set_Title("Eventos", () => Load_Scene_Menu_Item(Menu_item.Events));
            method(Button_Events, sprite_selected_events, sprite_unselected_events, Sprite_Events_Unread_Sel, Sprite_Events_Unread, selected, Database_Handler.Unread[typeof(Calendar_Events)]);
            break;

        case Menu_item.Polls:
            Title_Handler.Singleton.Set_Title("Encuestas");
            method(Button_Polls, sprite_selected_polls, sprite_unselected_polls, Sprite_Polls_Unread_Sel, Sprite_Polls_Unread, selected, Database_Handler.Unread[typeof(Polls)]);
            break;

        case Menu_item.Poll_details_single:
            Title_Handler.Singleton.Set_Title("Encuestas", () => Load_Scene_Menu_Item(Menu_item.Polls));
            method(Button_Polls, sprite_selected_polls, sprite_unselected_polls, Sprite_Polls_Unread_Sel, Sprite_Polls_Unread, selected, Database_Handler.Unread[typeof(Polls)]);
            break;

        case Menu_item.Media:
            Title_Handler.Singleton.Set_Title("Otros");
            method(Button_Media, sprite_selected_media, sprite_unselected_media, Sprite_Media_Unread_Sel, Sprite_Media_Unread, selected, false);
            break;

        case Menu_item.Users:
            Title_Handler.Singleton.Set_Title("Usuarios", () => Load_Scene_Menu_Item(Menu_item.Home));
            break;

        case Menu_item.Users_details:
            Title_Handler.Singleton.Set_Title("Usuarios", () => Load_Scene_Menu_Item(Menu_item.Users));
            break;

        case Menu_item.Rhythms:
            Title_Handler.Singleton.Set_Title("Ritmos", () => Load_Scene_Menu_Item(Menu_item.Media));
            break;

        case Menu_item.Config:
            Title_Handler.Singleton.Set_Title("Opciones", () => Load_Scene_Menu_Item(Menu_item.Home));
            break;

        case Menu_item.Send_Notification:
            Title_Handler.Singleton.Set_Title("Notificaciones", () => Load_Scene_Menu_Item(Menu_item.Users));
            break;

        case Menu_item.Edit:
            Title_Handler.Singleton.Set_Title("Editor", () => Load_Scene_Menu_Item(Prev_Item));
            break;

        case Menu_item.Construction:
            Title_Handler.Singleton.Set_Title("Hide");
            break;
        }
    }