Custom 'Game Saved' GUI Problem

Started by Mikhail, Mon 02/04/2012 18:42:07

Previous topic - Next topic

Mikhail

I just create a custom GUI that include the label 'Game Saved' and display it when player save the game.

I use the Transparency property (GUI) option too to display it when that GUI visible when player click the savegame btn on gSaveGame GUI.

The problem is,when i try to save the game when no current savegame data,the GUI display nicely,but when i try it to save for the second times when including the current savegame (whether to overwrite save game or create other new save game) the GUI not display anymore..

What's wrong?what the mistakes?

Below are the scripts that i use for;

Code: ags

function btnSaveGame_OnClick(GUIControl *control, MouseButton button)
{
  int gameSlotToSaveInto = lstSaveGamesList.ItemCount + 1;
  int i = 0;
  while (i < lstSaveGamesList.ItemCount)
  {
    if (lstSaveGamesList.Items[i] == txtNewSaveName.Text)
    {
      gameSlotToSaveInto = lstSaveGamesList.SaveGameSlots[i];
    }
    i++;
  }
  SaveGameSlot(gameSlotToSaveInto, txtNewSaveName.Text);
  close_save_game_dialog();

  gGameSaved.Visible = true;              // custom code that i used starting here
  gGameSaved.Centre();
  
  int trans = gGameSaved.Transparency;
  while (trans < 100) {
  trans++;
  gGameSaved.Transparency = trans;
  Wait(1);
}
   gMenu.Visible = true;
   gArrow.Visible = true;
  
  mouse.UseModeGraphic(eModePointer);    // end of my custom codes

}


Sorry for my bad English.

Khris

This should do it:

Code: ags

  ...
  gGameSaved.Centre();              // custom code that i used starting here
  gGameSaved.Visible = true;
  
  int trans = gGameSaved.Transparency;
  while (trans < 100) {
    trans++;
    gGameSaved.Transparency = trans;
    Wait(1);
  }
  gGameSaved.Visible = false;
  gGameSaved.Transparency = 0;        // reset transparency to 0

  gMenu.Visible = true;
  gArrow.Visible = true;
  
  mouse.UseModeGraphic(eModePointer);    // end of my custom codes
}


(You have to reset .Transparency to 0. I also changed the order slightly so the GUI is centered before it is shown.)

SMF spam blocked by CleanTalk