Exemple #1
0
 public static void luaInit()
 {
     if (Game.lua != null)
     {
         if (!luaInitd)
         {
             luaInitd = true;
             add("location");
             add("color4");
             add("color3");
             add("color3b");
             add("color4b");
             add("size");
             add("setFrameLocation");
             add("getFrameLocation");
             add("setAccuracyLocation");
             add("getAccuracyLocation");
             add("setScoreLocation");
             add("getScoreLocation");
             add("setPulseColor");
             add("getPulseColor");
             add("setBurstColor");
             add("getBurstColor");
             add("setLightColor");
             add("getLightColor");
             add("setKeyColor");
             add("getKeyColor");
             add("setBottomSpace");
             add("getBottomSpace");
             add("getBarColor");
             add("setBarColor");
             add("setTextOverlap");
             add("getTextOverlap");
             add("getAccuracyColor");
             add("setAccuracyColor");
             add("setClearFrame");
             add("getClearFrame");
             add("setLaneWidth");
             add("getLaneWidth");
             add("setEndColor");
             add("getEndColor");
             add("setStartColor");
             add("getStartColor");
             add("setColorHolds");
             add("getColorHolds");
             add("setDivColor");
             add("getDivColor");
             add("setMaskHolds");
             add("getMaskHolds");
             add("setMaskBursts");
             add("getMaskBursts");
             add("getHoldFramerate");
             add("setHoldFramerate");
             add("setBurstFramerate");
             add("getBurstFramerate");
             add("getHoldFramecount");
             add("getNoteFramecount");
             add("getNoteFramerate");
             add("setNoteFramerate");
             add("setNoteFramecount");
             add("setBurstFramecount");
             add("getBurstFramecount");
             add("setHoldFramecount");
             add("setScoreSize");
             add("getScoreSize");
             add("setAccuracySize");
             add("getAccuracySize");
         }
         defaultskin(Config.SkinFolder);
         if (File.Exists(Root + "config.lua"))
         {
             Game.lua.DoFile(Root + "config.lua");
         }
         noteStyle = 1;
         int total = 0;
         for (int x = 0; x < 8; x++)
         {
             laneLoc[x] = total;
             total += laneWidth[x];
         }
         playframe = new Frame(Skin.FrameLoc, false, false);
         editframe = new Frame(frameLoc, Config.EditMiddle, true);
         chatSound = Audio.AudioManager.loadFromFile(Root + "chatsound.mp3", true);
     }
 }
Exemple #2
0
 private void initUI()
 {
     if (skip != null)
     {
         UIComponents.Remove(skip);
     }
     skip = new Button(game, new Rectangle(400, 350, 200, 50), "Skip", delegate(int data)
     {
         running = true;
         unpause();
         music.PositionAsMilli = (long)startOffset - 2000;
         currentOffset = music.PositionAsMilli;
         skip.Visible = false;
         skip.Enabled = false;
     });
     UIComponents.Add(skip);
     if (startOffset < 2000)
     {
         skip.Visible = false;
         skip.Enabled = false;
     }
     else
     {
         skip.Visible = true;
         skip.Enabled = true;
     }
     bg = new Rect(new Rectangle(0, 0, Config.ResWidth, 768));
     if (currentSong.FileVersion == 0)
     {
         bg.useTexture("songs\\" + currentSong.Dir + "\\" + currentSong.BgName);
         music = AudioManager.loadFromFile("songs\\" + currentSong.Dir + "\\" + currentSong.FileName);
     }
     else
     {
         bg.useTexture("songs\\" + currentSong.Dir + "\\" + chart.BgName);
         music = AudioManager.loadFromFile("songs\\" + currentSong.Dir + "\\" + currentSong.FileName); //fix in future to load per chart
     }
     forceScores = false;
     failed = false;
     scores = false;
     running = false;
     paused = false;
     UIComponents.Clear();
     score = new Score();
     score.Flags = (int)mods.Flags;
     scoreFadeTime = 0;
     pulse = false;
     Config.Editing = false;
     Skin.PlayFrame = new Frame(Skin.FrameLoc, chart.Keys);
     frame = Skin.PlayFrame;
     setNoteOffsets(Skin.FrameLoc);
     tlContainer = new Rect(new Rectangle(Config.ResWidth - 605, 0, 605, 150), Skin.skindict["tlContainer"]);
     hpBar = new Rect(new Rectangle((int)frame.Location.X + (int)frame.Width, 0, 10, (int)frame.HitHeight));
     adjustHp(0);
     overlay = new Rect(new Rectangle(0, 0, Config.ResWidth, 768));
     overlay.Colour = new Color4(0.0f, 0.0f, 0.0f, 0.0f);
     glow = new Rect(new Rectangle((int)frame.Location.X, (int)frame.HitHeight - 43, (int)frame.Width, 40), Skin.skindict["keyLight"]);
     glow.Colour = Skin.PulseColour;
     for (int x = 0; x < lights.Length; x++)
     {
         presses[x] = new Rect(new Rectangle(frame.Location.X + frame.LaneLoc[x] + 5 + (1 * x), frame.Location.Y + 600, frame.LaneWidth[x] + 1, 50), Skin.skindict["press" + (x + 1)]);
         presses[x].fade(0.0f, 0.075);
         lights[x] = new Rect(new Rectangle(((frame.Location.X) + frame.LaneLoc[x]) + (1 * x) + 5 + 25, (int)frame.HitHeight - 53, 0, frame.LaneWidth[x]), Skin.skindict["keyLight"]);
         glows[x] = new Rect(new Rectangle(((frame.Location.X) + frame.LaneLoc[x]) + (1 * x) + 5, (int)frame.HitHeight - 203, frame.LaneWidth[x], 200), Skin.skindict["keyLight"]);
         glows[x].Colour = new Color4(1.0f, 1.0f, 1.0f, 0.5f);
         lights[x].Colour = Skin.LightColours[x];
         lights[x].fade(0.0f, 0.075);
         glows[x].fade(0.0f, 0.075);
     }
     songtitle = new Label(game, new Point(Config.ResWidth - 490, 10), currentSong.SongName + " - " + chart.Name);
     songartist = new Label(game, new Point(Config.ResWidth - 485, 60), currentSong.Artist);
     songtitle.TextTexture.TextFont = new Font("Myriad Pro", 35);
     songtitle.TextTexture.Shadow = false;
     songartist.TextTexture.Shadow = false;
     UIComponents.Add(songartist);
     UIComponents.Add(songtitle);
     if (calibrate)
     {
         offsetLabel = new Label(game, new Point(450, 85), "Average mistime: ");
         UIComponents.Add(offsetLabel);
         offsetLabel.Visible = true;
         offsetLabel.Enabled = true;
         offsets.Clear();
     }
     scoreLabel = new GraphicalText(score.TotalScore.ToString("D9"), Skin.ScoreLocation);
     scoreLabel.scale(new Size(30, 30), 0.1);
     comboText = new GraphicalText("0x", (new Point(frame.Location.X + (int)frame.Width / 2 - (int)(GraphicalText.measureString("0x", frame.LaneWidth[0])) / 2, frame.Location.Y + 200)));
     comboText.Visible = false;
     accuracyLabel = new GraphicalText("00.00%", Skin.AccLocation);
     pauseScreen = new PauseScreen(game, "pause", this);
     pauseScreen.OnLoad(null);
     countDown = new Label(game, new Point((int)frame.Location.X + (int)frame.Width + 20, (int)frame.HitHeight - 20), "00:00");
     countDown.TextTexture.TextFont = new Font("Myriad pro", 30);
     UIComponents.Add(countDown);
     scoreLabel.scale(new Size(Skin.ScoreSize.Width, Skin.ScoreSize.Height), 0.0);
     accuracyLabel.scale(new Size(Skin.AccSize.Width, Skin.AccSize.Height), 0.0);
     if (skip != null)
     {
         UIComponents.Add(skip);
     }
     bufferOverlay = new Rect(new Rectangle(0, 0, Config.ResWidth, 768));
     bufferOverlay.Colour = new Color4(0, 0, 0, 0.5f);
     bufferingLabel = new Label(game, new Point(Config.ResWidth / 2 - 100, 768 / 2 - 20), "Buffering...");
     specFailedLabel = new Label(game, new Point(Config.ResWidth / 2 - 100, 768 / 2 - 20), "User failed");
     userList = new Text(new Size(700, 100), new Point((int)frame.Width + 50, 70));
     oldSpecs = "";
 }