Beispiel #1
0
    public void SetTextSpeed(int speed)
    {
        byte spd = (byte)speed;

        try
        {
            if (spd != 0)
            {
                CurrentConnection.FreezeBytes(new byte[1] {
                    spd
                }, (uint)OffsetHelper.TextSpeedAddress);
            }
            else
            {
                CurrentConnection.UnFreezeBytes((uint)OffsetHelper.TextSpeedAddress);
            }
        }
        catch (Exception e) { PopupHelper.CreateError("Setting text speed failed: " + e.Message, 3f); }
    }
    IEnumerator createFreezes(uint[] offsets, int size, string creating)
    {
        int           count  = offsets.Length;
        List <byte[]> chunks = new List <byte[]>();

        UI_Popup.CurrentInstance.CreatePopupMessage(0.001f, $"Fetching {creating}", () => { });
        yield return(null);

        for (int i = 0; i < count; ++i)
        {
            chunks.Add(CurrentConnection.ReadBytes(offsets[i], size));
        }

        UI_Popup.CurrentInstance.CreatePopupMessage(0.001f, $"Creating freezers for {creating}", () => { });
        yield return(null);

        for (int i = 0; i < chunks.Count; ++i)
        {
            CurrentConnection.FreezeBytes(chunks[i], offsets[i]);
        }

        UI_Popup.CurrentInstance.CreatePopupMessage(2f, $"Successfully created freezers for {creating}!", () => { });
        UpdateFreezeCount();
    }