Exemple #1
0
 public void SetCurrentDirectory(string path)
 {
     if (!Directory.Exists(path))
     {
         ROSDesktop.OpenDialogue <ROSMessageDialogue>().SetContent("Directory Invalid", "The provided directory isn't valid:\n" + path);
         return;
     }
     currentDir = path;
 }
    private void Awake()
    {
        Desktop = this;

        // Add pick up / put down detection
        selectable.OnInteract += OnInteract;
        //selectable.OnFocus += OnPickedUp; // this seems broken for now
        selectable.OnDefocus += OnPutDown;

        Application.logMessageReceivedThreaded += HandleLog;

        lastFrameTime = Time.time;
        size          = appDisplayArea.rect.size;

        // try loading all the apps under appDisplayArea (this ensures apps like the console are setup before any log messages go that way)
        foreach (ROSApp app in appsToLoad)
        {
            if (app.IsDialogue())
            {
                Debug.LogError("ROSApp marked as dialogue but put in appsToLoad: " + app);
                continue;
            }
            RegisterApp(app);
        }
        appsToLoad.Clear();
        foreach (ROSApp dia in dialoguesToLoad)
        {
            if (!dia.IsDialogue())
            {
                Debug.LogError("ROSApp not marked as dialogue but put in dialoguesToLoad: " + dia);
                continue;
            }
            if (dia.IsSingleton())
            {
                Debug.LogError("ROSApp marked as dialogue is marked singleton, this isn't allowed: " + dia);
                continue;
            }
            RegisterApp(dia);
        }
        dialoguesToLoad.Clear();

        // load all app icons
        foreach (Type type in apps.Keys)
        {
            ROSApp app = apps[type];

            GameObject iconObj = Instantiate(appIconTemplate, appIconParent, false);
            iconObj.name = "App Icon:" + type;

            iconObj.transform.GetChild(0).GetComponent <Image>().color = Color.clear;

            iconObj.transform.GetChild(1).GetComponent <Image>().sprite = (app.appIcon != null ? app.appIcon : defaultAppIcon);

            iconObj.transform.GetChild(2).GetComponent <Text>().text = app.appName;

            iconObj.SetActive(true);

            appIconLookup.Add(iconObj, app);
        }

        dialogueBuildArea.gameObject.SetActive(false);
        appBuildArea.gameObject.SetActive(false);

        UpdateTimeTexts();
    }