private void OnMouseOver()
 {
     if (Input.GetButtonDown("Fire1"))
     {
         Rainity.OpenFile(filePath);
     }
 }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (TimerManager.instance == null)
        {
            return;
        }
        TimerManager.instance.Update();

        if (!GameEngine.instance.cpuNode.gameObject.activeSelf)
        {
            return;
        }

        MemoryInformation memInfo = Rainity.GetMemoryInformation();

        Ramt.text      = Mathf.Round(memInfo.ramUsed / memInfo.ramTotal * 100).ToString() + "%";
        RAM.fillAmount = memInfo.ramUsed / memInfo.ramTotal;
        // DiskInformation diskInfo = Rainity.GetDiskInformation("C:\\");



        if (timer <= 0)
        {
            timer = 1f;
            var cpuUsage = GetCPUPercent() / 1000000f;
            cput.text      = Mathf.Round(cpuUsage).ToString() + "%";
            cpu.fillAmount = cpuUsage / 100;
        }
        timer -= Time.deltaTime;
        //var d = Rainity.GetWeatherInformation();
        // Rainity.GetWallpaperImage();
        //int x = 0;
    }
Пример #3
0
    public void InitTray()
    {
        var tray = Rainity.CreateSystemTrayIcon();

        if (tray != null)
        {
            tray.AddItem("Exit", Quit);
            tray.SetTitle("35Miko");
        }
    }
 // 创建托盘图标、添加选项
 void AddSystemTray()
 {
     _icon = Rainity.CreateSystemTrayIcon();
     _icon.AddItem("切换置顶显示", ToggleTopMost);
     _icon.AddItem("切换开机自启", ToggleRunOnStartup);
     _icon.AddSeparator();
     // _icon.AddItem("检查更新", CheckUpdate);// 必然闪退
     _icon.AddItem("清除设置并退出", Clean);
     _icon.AddSeparator();
     _icon.AddItem("退出", Exit);
 }
Пример #5
0
    public void SimulateKey(int id)
    {
        RainityInput.VirtualKeys[] keys =
        {
            RainityInput.VirtualKeys.MediaPlayPause,
            RainityInput.VirtualKeys.MediaNextTrack,
            RainityInput.VirtualKeys.MediaPrevTrack
        };

        Rainity.SimulateKey((uint)keys[id]);
    }
    // Use this for initialization
    void Start()
    {
        filePath = filePath.Replace("\"", "");
        if (File.Exists(filePath))
        {
            iconVisual.material.mainTexture = Rainity.GetFileIcon(filePath);
            //border.material.SetColor("_Color", Rainity.GetAverageColorOfTexture((Texture2D)iconVisual.material.mainTexture));
        }
        else
        {
            UnityEngine.Debug.Log("Please assign a valid file path to the ProgramIcon script on " + transform.name + ".");
        }

        iconParent = transform.GetChild(0);
    }
Пример #7
0
    void ToggleRunOnStartup()
    {
        bool isRun = !DataModel.Instance.Data.isRunOnStartup;

        DataModel.Instance.Data.isRunOnStartup = isRun;
        DataModel.Instance.SaveData();
        _runOnStart.Image = isRun ? _enableImage : null;
        if (isRun)
        {
            Rainity.AddToStartup();
        }
        else
        {
            Rainity.RemoveFromStartup();
        }
    }
Пример #8
0
    public void OnSettingBtnClick(int index)
    {
        //on top
        if (index == (int)BtnType.TOP)
        {
            top = !top;
            ResourcesManager.instance.SetTop(top);
        }
        //on mute
        if (index == (int)BtnType.MUTE)
        {
            mut = !mut;
            ResourcesManager.instance.SetMute(mut);
        }
        //onstarup
        if (index == (int)BtnType.STARUP)
        {
            if (starup)
            {
                Rainity.RemoveFromStartup();
                PlayerPrefs.DeleteKey(mikomiko);
                starup = false;
            }
            else
            {
                PlayerPrefs.SetString(mikomiko, "Pekora");
                Rainity.AddToStartup();
                starup = true;
            }
        }

        //on chatbubble
        if (index == (int)BtnType.CHATBUBBLE)
        {
            chatbubble = !chatbubble;
            ResourcesManager.instance.SetChatBubble(chatbubble);
        }

        if (index == (int)BtnType.CPURAM)
        {
            cpu = !cpu;
            GameEngine.instance.SetCPURAM(cpu);
        }

        RefreshBtn();
        ResourcesManager.instance.SaveConfigToJsonConfig();
    }
Пример #9
0
    // Update is called once per frame
    void Update()
    {
        MemoryInformation memInfo = Rainity.GetMemoryInformation();

        ramText.text         = Mathf.Round(memInfo.ramUsed / memInfo.ramTotal * 100).ToString() + "%";
        ramImage.fillAmount  = memInfo.ramUsed / memInfo.ramTotal;
        vramText.text        = Mathf.Round(memInfo.vRamUsed / memInfo.vRamTotal * 100).ToString() + "%";
        vramImage.fillAmount = memInfo.vRamUsed / memInfo.vRamTotal;

        DiskInformation diskInfo = Rainity.GetDiskInformation("C:\\");

        diskText.text        = Mathf.Round((float)diskInfo.bytesFree / (float)diskInfo.bytesTotal * 100).ToString() + "%";
        diskImage.fillAmount = (float)diskInfo.bytesFree / (float)diskInfo.bytesTotal;

        cpuText.text        = Mathf.Round(Rainity.GetCPUUsagePercent()).ToString() + "%";
        cpuImage.fillAmount = Rainity.GetCPUUsagePercent() / 100;
    }
    void ToggleRunOnStartup()
    {
        bool isRun = !DataModel.Instance.Data.isRunOnStartup;

        DataModel.Instance.Data.isRunOnStartup = isRun;
        DataModel.Instance.SaveData();
        DataModel.Instance.ReloadData();
        if (isRun)
        {
            Rainity.AddToStartup();
            UIDialog.Instance.ShowDialog("开启开机自启", 3);
        }
        else
        {
            Rainity.RemoveFromStartup();
            UIDialog.Instance.ShowDialog("关闭开机自启", 3);
        }
    }
Пример #11
0
    // Use this for initialization
    void Start()
    {
        //Set file icon texture demonstration
        if (File.Exists(Environment.SystemDirectory + "\\notepad.exe"))
        {
            iconRenderer.material.mainTexture = Rainity.GetFileIcon(Environment.SystemDirectory + "\\notepad.exe");
        }
        //Set wallpaper image texture demonstration
        wallpaperRenderer.material.mainTexture = Rainity.GetWallpaperImage();
        //Set user avatar texture demonstration
        avatarRenderer.material.mainTexture = Rainity.GetUserAvatar();

        //Create system tray icon (standalone only, editor causes random crashes)
        tray = Rainity.CreateSystemTrayIcon();
        if (tray != null)
        {
            tray.AddItem("Context menu items with attached functions!", ExitApplication);
            tray.AddSeparator();
            tray.AddItem("Exit", ExitApplication);

            tray.SetTitle("Rainity Demo Application");
        }

        //Get information about the weather and assign text
        WeatherObject weather = Rainity.GetWeatherInformation();

        weather_cityState.text   = weather.query.results.channel.location.city + ", " + weather.query.results.channel.location.region;
        weather_temperature.text = weather.query.results.channel.item.condition.temp + "°" + weather.query.results.channel.units.temperature;
        weather_condition.text   = weather.query.results.channel.item.condition.text;
        weather_windSpeed.text   = "Wind speed: " + weather.query.results.channel.wind.speed + weather.query.results.channel.units.speed;

        RainityFile[] files = Rainity.GetFiles("C:\\Users\\Christian\\Desktop");
        foreach (RainityFile file in files)
        {
            Debug.Log(file.fileName);
        }
    }
Пример #12
0
    public void Awake()
    {
        instance = this;

        Initialize();
    }