HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: Can't edit prototype  (Read 333 times)

DireNinja

  • General Accounts
  • *
  • Posts: 5
    • View Profile
Can't edit prototype
« on: Aug 03, 20, 06:19:21 PM »

I am unable to modify this GUI prototype, it tells me that it doesn't exist when I try to open it. It also shows a script error saying that it can't create a node based on that prototype. But it clearly exists.

If you open the xml for the gui it shows that it inherits from _panel, while the prototype itself says that it inherits from _GUIBaseWindow.

I'm stuck here. I've tried a lot of things, I tried restarting heroblade, tried letting the world to go sleep and waking it back up, tried updating the script so that the parent class matches, a plethora of other things and I can't get past this.

The next step is to just start all over with a new GUI and have this garbage, non-functioning, thing out there forever. Which is the least desirable option, as it was not an insignificant amount of work getting the prototype the way I wanted it to begin with.

Any help at all would be greatly appreciated.
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Can't edit prototype
« Reply #1 on: Aug 04, 20, 09:30:50 AM »

Try changing the inheritance from _panel to _GUIBaseWindow.
There are a few fields in this class that are not in the other class.
Logged

DireNinja

  • General Accounts
  • *
  • Posts: 5
    • View Profile
Re: Can't edit prototype
« Reply #2 on: Aug 04, 20, 10:47:22 AM »

Try changing the inheritance from _panel to _GUIBaseWindow.
There are a few fields in this class that are not in the other class.


If you are talking about changing it in the XML, I did try that originally, it didn't help.
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Can't edit prototype
« Reply #3 on: Aug 04, 20, 11:51:45 AM »

could you expand upon some details?

The top line  in the xml file, and the code for UL_B_CharacterSelectionWindowClassMethods the function the error is in.
Logged

DireNinja

  • General Accounts
  • *
  • Posts: 5
    • View Profile
Re: Can't edit prototype
« Reply #4 on: Aug 04, 20, 12:05:25 PM »

This was all working fine. It was originally based on your tutorial. Things went screwy when I tried to change the parent class to panel instead of window in an attempt to get rid of the cross arrow move cursor. Because I docked mine right instead of making it movable.

Here is the GUI xml. When I signed in today, the gui editor window shows that this prototype now inherits GUIPanel, still the same results though.

Code: [Select]
<createControlType inheritFrom='_panel' class='UL_B_CharacterSelectionWindow' type='UL_B_CharacterSelectionWindow' description='UL Base Character Selection Window' treePath='' name="UL_B_CharacterSelectionWindow" dockMode="RIGHT" texture="\GUI\UL-Interface1.png" ignoreMouseEvents="true" inheritDisabledState="false" inheritSelectedState="false" inheritHoveringState="false">
  <size x="500" y="637"/>
  <defaultStatePresentation>
    <color a="1"/>
    <position x="492" y="300"/>
    <size x="531.805725098" y="183.130706787"/>
  </defaultStatePresentation>
  <disabledStatePresentation>
    <position x="492" y="300"/>
    <size x="531.805725098" y="183.130706787"/>
  </disabledStatePresentation>
  <hoverStatePresentation>
    <position x="492" y="300"/>
    <size x="531.805725098" y="183.130706787"/>
  </hoverStatePresentation>
  <selectedStatePresentation>
    <position x="492" y="300"/>
    <size x="531.805725098" y="183.130706787"/>
  </selectedStatePresentation>
  <selectedDisabledStatePresentation>
    <position x="492" y="300"/>
    <size x="531.805725098" y="183.130706787"/>
  </selectedDisabledStatePresentation>
  <selectedHoverStatePresentation>
    <position x="492" y="300"/>
    <size x="531.805725098" y="183.130706787"/>
  </selectedHoverStatePresentation>
  <_panel name="buttons" dockMode="BOTTOM" insertBefore="scrollable">
    <size x="500" y="100"/>
    <defaultStatePresentation>
      <color a="0"/>
    </defaultStatePresentation>
    <disabledStatePresentation>
      <color a="0"/>
    </disabledStatePresentation>
    <hoverStatePresentation>
      <color a="0"/>
    </hoverStatePresentation>
    <selectedStatePresentation>
      <color a="0"/>
    </selectedStatePresentation>
    <selectedDisabledStatePresentation>
      <color a="0"/>
    </selectedDisabledStatePresentation>
    <selectedHoverStatePresentation>
      <color a="0"/>
    </selectedHoverStatePresentation>
    <UL_B_Button name="loginButton" inheritHoveringState="false">
      <size x="100" y="50"/>
      <selectedHoverStatePresentation>
        <color r="1" g="1" b="1" a="1"/>
      </selectedHoverStatePresentation>
      <set name='UL_B_CharacterSelectionWindow.buttons.loginButton.text' attribute='text' value="Enter World"/>
    </UL_B_Button>
    <UL_B_Button name="createButton" inheritHoveringState="false">
      <position x="110"/>
      <size x="100" y="50"/>
      <selectedHoverStatePresentation>
        <color r="1" g="1" b="1" a="1"/>
      </selectedHoverStatePresentation>
      <set name='UL_B_CharacterSelectionWindow.buttons.createButton.text' attribute='text' value="Create New Character"/>
    </UL_B_Button>
    <UL_B_Button name="deleteButton" inheritHoveringState="false">
      <position x="110" y="50"/>
      <size x="100" y="50"/>
      <selectedHoverStatePresentation>
        <color r="1" g="1" b="1" a="1"/>
      </selectedHoverStatePresentation>
      <set name='UL_B_CharacterSelectionWindow.buttons.deleteButton.text' attribute='text' value="Delete Character"/>
    </UL_B_Button>
    <UL_B_Button name="exitButton" inheritHoveringState="false">
      <position y="50"/>
      <size x="100" y="50"/>
      <selectedHoverStatePresentation>
        <color r="1" g="1" b="1" a="1"/>
      </selectedHoverStatePresentation>
      <set name='UL_B_CharacterSelectionWindow.buttons.exitButton.text' attribute='text' value="Exit Game"/>
    </UL_B_Button>
  </_panel>
  <set name='UL_B_CharacterSelectionWindow.scrollable' attribute='ignoreMouseEvents' value="false"/>
  <set name="UL_B_CharacterSelectionWindow.scrollable.scrollbar.corner">
    <set name='UL_B_CharacterSelectionWindow.scrollable.scrollbar.corner' attribute='opacity' value="0"/>
    <set name='UL_B_CharacterSelectionWindow.scrollable.scrollbar.corner' attribute='opacityModifier' value="0"/>
    <defaultStatePresentation>
      <color r="1" g="1" b="1" a="0"/>
    </defaultStatePresentation>
    <disabledStatePresentation>
      <color a="0"/>
    </disabledStatePresentation>
    <hoverStatePresentation>
      <color a="0"/>
    </hoverStatePresentation>
    <selectedStatePresentation>
      <color a="0"/>
    </selectedStatePresentation>
    <selectedDisabledStatePresentation>
      <color a="0"/>
    </selectedDisabledStatePresentation>
    <selectedHoverStatePresentation>
      <color a="0"/>
    </selectedHoverStatePresentation>
  </set>
  <set name="UL_B_CharacterSelectionWindow.scrollable.clientarea">
    <defaultStatePresentation>
      <color r="1" g="1" b="1" a="0"/>
    </defaultStatePresentation>
    <hoverStatePresentation>
      <color a="0"/>
    </hoverStatePresentation>
    <set name='UL_B_CharacterSelectionWindow.scrollable.clientarea' attribute='ignoreMouseEvents' value="false"/>
  </set>
  <_panel name="_panel" dockMode="TOP">
    <size x="500" y="50"/>
    <defaultStatePresentation>
      <color a="0"/>
    </defaultStatePresentation>
    <disabledStatePresentation>
      <color a="0"/>
    </disabledStatePresentation>
    <hoverStatePresentation>
      <color a="0"/>
    </hoverStatePresentation>
    <selectedStatePresentation>
      <color a="0"/>
    </selectedStatePresentation>
    <selectedDisabledStatePresentation>
      <color a="0"/>
    </selectedDisabledStatePresentation>
    <selectedHoverStatePresentation>
      <color a="0"/>
    </selectedHoverStatePresentation>
    <_panel name="_panel" dockMode="RIGHT" opacity="0">
      <size x="50" y="50"/>
    </_panel>
    <_label name="title" dockMode="RIGHT" text="Select Character" displayfont="LARGETEXT" dropShadowAlpha="1" justification="RIGHT">
      <size x="500" y="50"/>
      <defaultStatePresentation>
        <color r="1" g="1" b="1"/>
      </defaultStatePresentation>
    </_label>
  </_panel>
</createControlType>

Here is the class methods code:

Code: [Select]
public function Open( args as LookupList indexed by String of String ) as NodeRef of Class GUIControl
// typically args["names"] will contain a list of character names to populate the control
//   additional information may be included depending on game specific implementations
//
// called from $CHARACTERSELECTIONSYSTEM._CSSInvokeGUI
  $GUI._clearGUI()
  var css = GetCharacterSelectionWindowClass()
  css = CreateNodeFromPrototype( "UL_B_CharacterSelectionWindow" )
  css.build = true
  css.centerControlOver( 0 )

  names as List of String
  unmarshal names from args["names"]

  css._cssPopulateNamesList( names )

  //var loginButton = css._cssGetLoginButton()
  //SetKeyboardFocus( loginButton )
 
  // add a listener to CHARACTERSELECTIONSYSTEM
  var listener = $CHARACTERSELECTIONSYSTEM.createNodeListener( css, false )
  addAssociation( css, "base_hard_association", listener )
  $CHARACTERSELECTIONSYSTEM.addListener( listener )
 
  return css
.

method _cssPopulateNamesList( names as List of String )
  var clientArea = me.getClientarea()
 
  foreach child in clientArea.children
    DestroyNode( child )
  .
 
  if names.length == 0
    lbl as NodeRef of Class GUILabel = CreateNodeFromPrototype( "_label" )
    lbl.text = "You have no characters!"
    lbl.dockMode = FILL
    lbl.justification = center
    add back lbl to clientArea.children
  else
    char as NodeRef of Class GUIControl
    foreach name in names
      if name <> ""
        char = createNodeFromPrototype("UL_B_CharacterSelectionName")
        char.build = true
        char.dockMode = TOP
        lbl as NodeRef of Class GUILabel = FindGUIControlByName(char, "name")
        lbl.text = name
        add back char to clientArea.children
        if clientArea.children.length == 1
          char.selected = true
        .
      .
    .
  .
.

method EventRaised( obs as NodeRef of Class ObsSubject, data as NodeRef )
// NOTE The data passed in is "owned" by the observer pattern and will be deleted at
//        when the notifications are complete.  No listener should try to persist this
//        data node rather it should copy the data if it needs it beyond script execution.
//
  where data
    is kindof eventObject
      when data.eventType
        is "CSSCHARACTERCREATED"
          DestroyNode( me )
        .
        is "CSSCHARACTERSELECTED"
          destroyNode( me )
        .
        is "CSSCHARACTERLISTRECEIVED"
          me._cssPopulateNamesList( $CHARACTERSELECTIONSYSTEM._CSSGetCharacterList() )
        .
        is "CSSDELETECHARACTER"
          me._cssPopulateNamesList( $CHARACTERSELECTIONSYSTEM._CSSGetCharacterList() )
        .
        is "CSSCONFIRMDELETECHARACTER"
          println("Got delete confirmation event")
          $CHARACTERSELECTIONSYSTEM._CSSRequestDeleteCharacter( me._cssGetSelectedCharacterName(), None )
        .
        default
          println("Got event: " + data.eventType + " but I don't know what to do now?")
        .
      .
    .
    default
      // unknown data node type, no clue how to handle this
    .
  .
.

method _OnButtonMouseClick(button as NodeRef of Class _GUIButton, args references Class GUIMouseEvent)
  when button.name
    is "loginButton"
      // Tell the server to load normally or into a clean test area
      //$CHARACTERSELECTIONSYSTEM._CSSRequestSetLoadInCleanTestArea( me._cssIsCleanChecked(), None )
     
      var listener = $CHARACTERSELECTIONSYSTEM.createNodeListener( me, false )
      $CHARACTERSELECTIONSYSTEM._CSSRequestSelectCharacter( me._cssGetSelectedCharacterName(), listener )
     
      // Until chat buffering is set to false, no chat messages will be displayed in the
      //   chat panel or your game specific chat
      $BASECLIENT._setChatBuffering( false )
    .
    is "createButton"
      arguments as LookupList indexed by String of String
      var listener = $CHARACTERSELECTIONSYSTEM.createNodeListener( me, false )
     
      $CHARACTERSELECTIONSYSTEM._CSSRequestCreateCharacter( arguments, listener )
    .
    is "deleteButton"
      if me._cssGetSelectedCharacterName() = ""
        $ALERT._CleanModalAlert( "No character is selected." )
      else
        var listener = $CHARACTERSELECTIONSYSTEM.createNodeListener( me, false )
        $CHARACTERSELECTIONSYSTEM.addListener( listener )
        me._cssShowDeleteCharacterWarning( me._cssGetSelectedCharacterName() )
      .
    .
    is "exitButton"
      $BASECLIENT._Exit()
    .
    is "cancelDelete"
      DestroyNode( button.rootParent() )
    .
    is "deleteConfirm"
      $CHARACTERSELECTIONSYSTEM._CSSConfirmDeleteCharacter()
     
      DestroyNode( button.rootParent() )
    .
    default
      ScriptError( "Unknown button: " + button.name + "." )
    .
  .
.

method _cssGetSelectedCharacterName() as String
  var clientArea = me.GetClientArea()
  name as String
  foreach child in clientArea.children
    if child.selected
      lbl as NodeRef of Class GUILabel = FindGUIControlByName( child, "name" )
      name = lbl.text
      break
    .
  .
 
  return name
.

method _cssShowDeleteCharacterWarning( name as String )
  warning as NodeRef of Class GUIControl = CreateNodeFromPrototype( "_cssDeleteCharacterWarning" )
  warning.build = true

  warning.name = "HE_DeleteCharacterWarning"
  screen as Vector3 = GetViewPortSize()
  warning.position.x = ( ( screen.x - warning.size.x ) / 2 )
  warning.position.y = ( ( screen.y - warning.size.y ) / 2 )
  var deleteButton = FindGUIControlByName( warning, "buttonpanel.deleteConfirm" )
  if deleteButton != None
    deleteButton._resetButtonText( " Yes " )
  .
  var cancelButton = FindGUIControlByName( warning, "buttonpanel.cancelDelete" )
  if cancelButton != None
    cancelButton._resetButtonText( " No " )
  .
  myLabel as NodeRef of Class GUILabel = FindGUIControlByName( warning, "scrollable.clientarea.text" )
  myLabel.text = "WARNING!$RDo you wish to delete " + name + "?"
  warning.createModalDialog( None )
.

method OnMouseClick(args references Class GUIMouseEvent)
  target as NodeRef of Class GUIControl = args.source
  when target.name
    is "UL_B_CharacterSelectionName"
      me.ClearSelectedName()
      target.selected = true
    .
  .
.

method ClearSelectedName()
  var clientArea = me.GetClientArea()
  foreach child in clientArea.children
    if child.selected = true
      child.selected = false
    .
  .
.

method GetClientArea() as NodeRef of Class GUIControl
  return FindGUIControlByName(me, "scrollable.clientarea")
.

function GetCharacterSelectionWindowClass() as NodeRef of Class UL_B_CharacterSelectionWindow
  return FindGUIControlByName(None, "UL_B_CharacterSelectionWindow")
.
« Last Edit: Aug 04, 20, 12:07:21 PM by DireNinja »
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Can't edit prototype
« Reply #5 on: Aug 04, 20, 12:30:19 PM »

GuiPanel is the class for which _panel is the prototype.

The window also has a dockmode, where you can make the whole window docked on the right.

I have replicated the error changing the inherited to _panel

Did you make a class UL_B_Window ? Then create a prototype from this, and use this as the inherit for the UL_B_CharacterSelectionWindow xml file.
Logged

DireNinja

  • General Accounts
  • *
  • Posts: 5
    • View Profile
Re: Can't edit prototype
« Reply #6 on: Aug 04, 20, 12:35:54 PM »

Yeah window has dockmode, but when i docked it, even making movable = false, the cursor was still changing to the little cross arrow move cursor like it was movable. I did make a UL_B_Window class, but this didnt inherit from it, I made this one as a one off, because I didnt want it to look the same as the windows in game. I originally had it inherit from guiwindow but i removed that parent class and thats when things went screwy. Adding it back or adding a new parent didnt fix anything though.
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Can't edit prototype
« Reply #7 on: Aug 04, 20, 12:40:05 PM »

in the gui, look for ignore mouse events, setting this to true, means the mouse will not be able to move it, and the cross arrow will not show  up.

edit:
you can also make another class UL_B_SelWindow (or something similar) and inherit from that, making that gui the way you want it to look.
« Last Edit: Aug 04, 20, 12:42:15 PM by Thazager »
Logged

DireNinja

  • General Accounts
  • *
  • Posts: 5
    • View Profile
Re: Can't edit prototype
« Reply #8 on: Aug 04, 20, 03:53:40 PM »

I found the issue, somehow the class inheritance was removed. I added it back on there and it works now.
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Can't edit prototype
« Reply #9 on: Aug 04, 20, 08:44:56 PM »

glad its fixed and working
Logged