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

Author Topic: basic guild type window  (Read 1971 times)

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
basic guild type window
« on: Apr 01, 14, 11:36:08 PM »

This will make a basic Guild type window, with 2 resizable windows in it. The small windows can be stretched left and right. They have max sizes set. There is a small jitter as the window resizes. If you comment out the lines to resize the main window, you can see why it was added.


In the DOM, create a new (client side) class
name = TMP_ResizeWindow
archtype = guicontrol
add a parent to the class, _GUIBaseWindow

click open script

In new script TMP_ResizeWindow

Code: [Select]
// used to resize the panels to fit on window
method onMouseDrag(args references Class GUIMouseEvent)
  over as NodeRef of Class GUIControl = GetGUIControlUnderMouse()
  overPP as NodeRef of Class GUIControl

  if over <> None
    if over.parent <> None   // lots of checks to make sure it works
      if over.parent.parent <> None
        if over.parent.parent.parent <> None
          if over.parent.parent.parent.parent <> None
            overPP = over.parent.parent.parent.parent
            if overPP <> None
              if overPP.name <> " TMP_GuildWindow"
                return
              .
            .
          .
        .
      .
    .
  .

  if args.source is kindof GUIResizePanel
    if over <> None
      win as NodeRef of Class HaV_SGWindow = FindGUIControlByName(None, "game.TMP_GuildWindow")
      type as NodeRef of Class GUIControl
      if win.TMP_resize = "1"
        win.TMP_resize = "2"
        win.size.y += 0.5
      else if win.TMP_resize = "2"
        win.TMP_resize = "1"
        win.size.y -= 0.5
      .
    .
  .
.

 

In new (client side) script TMP_ResizeWindow.XML   (gui file)

Code: [Select]
<createControlType class='TMP_ResizeWindow' type='TMP_ResizeWindow' description='' treePath='' name="TMP_ResizeWindow" textureFilter="false" allowMove="false" resizeable="ALL" scrollable="VERTICAL">
  <size x="50" y="250"/>
  <minimumSize x="50"/>
  <maximumSize x="200" y="2048"/>
  <defaultStatePresentation>
    <color r="0" g="0" b="0" a="0.300000012"/>
  </defaultStatePresentation>
  <hoverStatePresentation>
    <color r="0" g="0" b="0" a="0.300000012"/>
  </hoverStatePresentation>
  <selectedHoverStatePresentation>
    <color r="0" g="0" b="0" a="0"/>
    <size x="0" y="0"/>
  </selectedHoverStatePresentation>
  <_resizeLeft name="resizeLeft">
    <size x="1" y="250"/>
    <minimumSize x="1"/>
    <maximumSize x="100"/>
    <defaultStatePresentation>
      <size x="1"/>
    </defaultStatePresentation>
    <resize left="false" right="true"/>
  </_resizeLeft>
  <_resizeRight name="resizeRight" texture="\GUI\_CleanEngineGUI.dds">
    <size x="3" y="250"/>
    <minimumSize x="3"/>
    <maximumSize x="100"/>
    <defaultStatePresentation>
      <position x="31"/>
      <size x="1"/>
    </defaultStatePresentation>
  </_resizeRight>
  <_panel name="_panel" dockMode="TOP" texture="\GUI\_CleanEngineGUI.dds">
    <size x="46" y="20"/>
    <minimumSize x="42" y="20"/>
    <anchor right="true"/>
    <defaultStatePresentation>
      <position x="745" y="260"/>
      <size x="92" y="30"/>
    </defaultStatePresentation>
  </_panel>
</createControlType>

the texture might be off a little for the panel - position and size (as this was used from our texture set)

_________________________________________________________________________
In the DOM, create a new (client side) field
name = TMP_Resize
type  = string

In the DOM, create a new (client side) class
name = TMP_GuildWindow
archtype = guicontrol

add a parent to the class, _GUIBaseWindow
add a field to the class, TMP_Resize

click open script

In new script TMP_GuildWindow

Code: [Select]
// make the guild window
shared function Start()
  Win as NodeRef of Class TMP_GuildWindow = FindGUIControlByName(None, "game.TMP_GuildWindow")
  if Win <> None
    DestroyNode( Win )
  .
  Win = CreateNodeFromPrototype( "TMP_GuildWindow" )
  Win.build = true
  Win.owner = 0
  Win.HaV_resize = "1"
.

In new (client side) script TMP_GuildWindow.XML   (gui file)

Code: [Select]
<createControlType class='TMP_GuildWindow' type='TMP_GuildWindow' description='' treePath='' name="'TMP_GuildWindow" textureFilter="false" layer="game" allowTitlebar="false" allowCloseButton="false" allowDragging="false" resizeable="ALL" scrollable="VERTICAL" allowHelpButton="false" allowMinimizeButton="false">
  <position x="300" y="300"/>
  <size x="300" y="250"/>
  <maximumSize x="2048" y="2048"/>
  <defaultStatePresentation>
    <color r="0" g="0" b="0" a="0.5"/>
  </defaultStatePresentation>
  <selectedHoverStatePresentation>
    <color r="0" g="0" b="0" a="0"/>
    <size x="0" y="0"/>
  </selectedHoverStatePresentation>
  <_panel name="Mainpanel" dockMode="TOP">
    <size x="276" y="30"/>
    <minimumSize y="30"/>
    <maximumSize x="2000" y="30"/>
    <defaultStatePresentation>
      <color a="0"/>
    </defaultStatePresentation>
  </_panel>
  <_scrollableParent name="scrollable">
    <set name="TMP_GuildWindow.scrollable.clientarea">
      <defaultStatePresentation>
        <color r="0" g="0" b="0" a="0"/>
      </defaultStatePresentation>
    </set>
    <set name="TMP_GuildWindow.scrollable.clientarea">
      <TMP_ResizeWindow name="win1" dockMode="LEFT">
        <size y="196"/>
        <set name="TMP_GuildWindow.scrollable.clientarea.win1._panel">
          <_label name="text" dockMode="FILL" text="name" justification="CENTER">
            <size x="46"/>
            <defaultStatePresentation>
              <color r="0" g="0" b="0"/>
            </defaultStatePresentation>
          </_label>
        </set>
      </TMP_ResizeWindow>
    </set>
    <set name="TMP_GuildWindow.scrollable.clientarea">
      <TMP_ResizeWindow name="win2" dockMode="LEFT">
        <size y="196"/>
        <set name="TMP_GuildWindow.scrollable.clientarea.win2._panel">
          <_label name="text" dockMode="FILL" text="rank" justification="CENTER">
            <size x="46"/>
            <defaultStatePresentation>
              <color r="0" g="0" b="0"/>
            </defaultStatePresentation>
          </_label>
        </set>
      </TMP_ResizeWindow>
    </set>
  </_scrollableParent>
</createControlType>
_________________________________________________________________________

In client side script E_PlayerAccountClassMethods

under the chat window code

Code: [Select]
  TMP_GuildWindowClassMethods:start()


Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685