file Gary's Easy/Basic Replay Center!

  • Gary
  • Gary's Avatar Topic Author
  • Offline
  • Intermediate Marbler
  • Intermediate Marbler
  • Hi all
  • Posts: 80
  • Thank you received: 8
07 Aug 2013 15:02 - 10 Jun 2014 05:39 #1
This is a basic replay center code.I hope you enjoy for this~
I refer to Jeff's Custom Marble Selector code to write the Reply Center Code....
This is just a easy and basic kind of Reply Center code.You can make it better if you want/can~

go to marble/client/init.cs and add this to where the others are being exec'd..
Code: //recordinggui
exec(./ui/RecordingsDlg.gui); //we will create it later
exec(./scripts/recordings.cs);//we will create it later


paste this code in a new file called RecordingsDlg.gui:
this goes in marble/client/ui
(you can see..this is just the modification of Jeff's marbleselectordlg.gui ,but different , i added a back bottom. and maybe you should find a picture for the bitmap of BACK/CANCEL buttom )
Code://--- OBJECT WRITE BEGIN ---
new GuiControl(recordingsDlg) {
profile = GuiDefaultProfile;
horizSizing = center;
vertSizing = center;
position = -1 44;
extent = 641 392;
minExtent = 8 8;
visible = 1;
helpTag = 0;

new GuiBitmapCtrl() {
profile = GuiDefaultProfile;
horizSizing = center;
vertSizing = center;
position = 15 10;
extent = 400 280;
minExtent = 8 8;
visible = 1;
helpTag = 0;
bitmap = common/ui/dialog;
wrap = 0;

new GuiScrollCtrl() {
profile = GuiScrollProfile;
horizSizing = right;
vertSizing = bottom;
position = 93 36;
extent = 209 129;
minExtent = 8 8;
visible = 1;
helpTag = 0;
willFirstRespond = 1;
hScrollBar = dynamic;
vScrollBar = alwaysOn;
constantThumbHeight = 0;
childMargin = 0 0;
defaultLineHeight = 15;

new GuiTextListCtrl(RecordingsDlgList) {
profile = GuiTextArrayProfile;
horizSizing = right;
vertSizing = bottom;
position = 2 2;
extent = 416 8;
minExtent = 8 8;
visible = 1;
helpTag = 0;
enumerate = 0;
resizeCell = 1;
columns = 0;
fitParentWidth = 1;
clipColumnText = 0;
noDuplicates = false;
};
};
new GuiBitmapButtonCtrl() {
profile = GuiButtonProfile;
horizSizing = right;
vertSizing = bottom;
position = 107 188;
extent = 77 58;
minExtent = 8 8;
visible = 1;
command = StartSelectedRpy();;
helpTag = 0;
text = Choose;
groupNum = -1;
buttonType = PushButton;
repeatPeriod = 1000;
repeatDecay = 1;
bitmap = common/ui/ok;
};
new GuiBitmapButtonCtrl() {
profile = GuiButtonProfile;
horizSizing = right;
vertSizing = bottom;
position = 207 188;
extent = 77 58;
minExtent = 8 8;
visible = 1;
command = Canvas.popDialog(recordingsDlg);;
helpTag = 0;
text = Back;
groupNum = -1;
buttonType = PushButton;
repeatPeriod = 1000;
repeatDecay = 1;
bitmap = marble/client/ui/back;
};
};
};
//--- OBJECT WRITE END ---


at last , go marble/client/scripts , create and paste as recordings.cs
Code://By Gary..
function recordingsDlg::onWake()
{
recordingsDlg.BuildList();
RecordingsDlgList.setSelectedRow(0);
RecordingsDlgList.scrollVisible(0);
}

//
function recordingsDlg::BuildList(%this) {
RecordingsDlgList.clear();
%i = 0;
//Build reply file list
for(%file = findFirstFile(marble/client/demos/*.rec); %file !$= ;
%file = findNextFile(marble/client/demos/*.rec))
{
%i ++;
$MSF[%i] = filebase(%file);
RecordingsDlgList.addRow(%i, $MSF[%i]);
}
}

//you can write a moer powerful StartSelectedRpy function (you can call it StartSelectedDemo function if you like..) if you can..
function StartSelectedRpy()
{
%selid = RecordingsDlgList.getSelectedId();
%selrpy = RecordingsDlgList.getRowTextbyId(%selid);
%file = $currentMod @ /client/demos/ @ getField(%selrpy, 0) @ .rec;
PlayDemo(%file);
}


What you should do is add a button to open the RecordingsDlg .like this..
Code: new GuiBitmapButtonCtrl(PLEASE_RENAME_IT) {
profile = GuiButtonProfile;
horizSizing = left;
vertSizing = top;
position = 529 387;
extent = 106 85;
minExtent = 8 8;
visible = 1;
command = StopDemoTimer(); Canvas.pushDialog(recordingsDlg); ;//StopDemoTimer() is for mainmenugui...
helpTag = 0;
text = play;
groupNum = -1;
buttonType = PushButton;
bitmap = ./PATH/FILENAME;
};


It works like this:(this is in my mod MarbleBlast-HappyRoll...)

Enjoy it~

Gary~

HappyRoll Mod Leader
C++ Beginner
Last edit: 10 Jun 2014 05:39 by Gary. Reason: for reply to replAy. a spell mistake

Please Log in or Create an account to join the conversation.

  • Posts: 301
  • Thank you received: 57
07 Aug 2013 22:07 #2
Reply = Replay if someone was wondering.

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
07 Aug 2013 22:54 #3
Nice code Gary

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

Moderators: Doomblah
Time to create page: 1.434 seconds