Exemplo n.º 1
0
    // Launches a menu of selectable options, populated by initialized dictionary
    static public async Task <object> LaunchMenuAsync(MenuType mType, CancellationToken ct = default)
    {
        GameObject  picker  = GameObject.Instantiate(prefabMenu);
        MenuMonitor monitor = picker.GetComponent <MenuMonitor>();

        object result = await monitor.SetMonitorAsync(mType, ct);

        if (result == null)
        {
            return(null);                // Close returns null
        }
        return(mType switch
        {
            MenuType.Main => (MenuName)result,
            MenuType.Trait => Trait.CreateNew((TraitType)result),
            _ => null,
        });
Exemplo n.º 2
0
 public void SetMenuItem(MenuName menuName, string displayText, MenuMonitor monitor)
 {
     gameObject.GetComponent <Text>().text = displayText;
     this.menuName = menuName;
     this.monitor  = monitor;
 }