/// <summary> /// Update /// </summary> public override void Update() { DemoReel demo = (DemoReel)RB.Game; mShiftPressed = false; if (RB.KeyDown(KeyCode.LeftShift) || RB.KeyDown(KeyCode.RightShift) || mKeys["LeftShift"].WasPointerPressed || mKeys["RightShift"].WasPointerPressed) { mShiftPressed = true; } mNextButton.Update(); mPrevButton.Update(); ProcessStringInput(RB.InputString()); int color = 1; if ((RB.Ticks % 200 > 170 && RB.Ticks % 200 < 180) || (RB.Ticks % 200) > 190) { color = 5; } mNextButton.LabelColor = color; mPrevButton.LabelColor = color; mScrollDelta = RB.PointerScrollDelta(); mScrollDeltaAnim = Mathf.Lerp(mScrollDeltaAnim, mScrollDelta, 0.25f); if (RB.ButtonPressed(RB.BTN_SYSTEM)) { Application.Quit(); } }
private void NextScreenButtonCB(Button button, object userData) { DemoReel demo = (DemoReel)RB.Game; demo.NextScene(); }
private void PrevScreenButtonCB(Button button, object userData) { DemoReel demo = (DemoReel)RB.Game; demo.PreviousScene(); }
/// <summary> /// Highlight code in given string /// </summary> /// <param name="inStr">Input string</param> /// <param name="outStr">Output string</param> /// <returns>Highlighted code</returns> public static FastString HighlightCode(FastString inStr, FastString outStr) { DemoReel game = (DemoReel)RB.Game; var buf = inStr.Buf; outStr.Clear(); for (int i = 0; i < inStr.Length; i++) { if (buf[i] == '@') { i++; switch (buf[i]) { case 'I': // Indexed color int colorIndex = ((int)(buf[i + 1] - '0') * 10) + (int)(buf[i + 2] - '0'); Color32 rgb = IndexToRGB(colorIndex); IndexToColorString(21, outStr).Append("new"); IndexToColorString(22, outStr).Append(" Color32"); IndexToColorString(5, outStr).Append("("); IndexToColorString(24, outStr).Append(rgb.r); IndexToColorString(5, outStr).Append(", "); IndexToColorString(24, outStr).Append(rgb.g); IndexToColorString(5, outStr).Append(", "); IndexToColorString(24, outStr).Append(rgb.b); IndexToColorString(5, outStr).Append(", "); IndexToColorString(24, outStr).Append(255); IndexToColorString(5, outStr).Append(")"); i += 2; break; case 'K': // Keyword IndexToColorString(21, outStr); break; case 'M': // Class or Method IndexToColorString(22, outStr); break; case 'L': // Literal IndexToColorString(24, outStr); break; case 'C': // Comment IndexToColorString(25, outStr); break; case 'S': // String literal IndexToColorString(15, outStr); break; case 's': // String escape code IndexToColorString(14, outStr); break; case 'E': IndexToColorString(23, outStr); break; case 'N': // Normal/Other IndexToColorString(5, outStr); break; case 'D': // Dark IndexToColorString(3, outStr); break; case '@': outStr.Append("@@"); break; default: IndexToColorString(5, outStr); break; } } else { outStr.Append(buf[i]); } } return(outStr); }