UWindow
Re: UWindow
for now i can make a window ingame but i can only see it if i hit esc, how to show it directly in the game?
- EvilGrins
- Godlike
- Posts: 9769
- Joined: Thu Jun 30, 2011 8:12 pm
- Personal rank: God of Fudge
- Location: Palo Alto, CA
- Contact:
Re: UWindow
do me a favor? take a screenshot of the window ingame and post it here... cuz I'm not sure exactly what you mean.>@tack!< wrote:for now i can make a window ingame but i can only see it if i hit esc, how to show it directly in the game?
http://unreal-games.livejournal.com/
Smilies · viewtopic.php?f=8&t=13758medor wrote:Replace Skaarj with EvilGrins
Re: UWindow
sorry making SS with my laptop is somehow working weird. but i think i know what to do i just have to know how to open the windowconsole of a player in script, anyone?
- The_Cowboy
- Skilled
- Posts: 165
- Joined: Mon Jan 24, 2011 3:22 am
- Personal rank: Codezilla
Re: UWindow
For that you must see WRI code written by Mongo and Dr Sin.
Now make its child class,
And finally call this function to open/pop Uwindow
EDIT by papercoffee............................... Avoid double posts please.
Now I see the date of the post ...Gosh it is 2:20 Am here much too late to stay awake ...sorry
For designing UWindows you should see live examples from mods themselves.Here are some of them
1)Admin Tool by [os]sphx
2)BDB's Mapvote
3)ACEManager
Code: Select all
*/
//=============================================================================
// WindowReplicationInfo.
//
// The WRI is used to popup UWindow classes on the client. Most likely you will
// want to expand this actor in to a child. It has no built in functionality
// other than making the window appear.
//
//=============================================================================
class WRI expands ReplicationInfo;
// Replicated Server->Client Variables
// What type of Window to open
var() class <UWindowWindow> WindowClass;
// Dims of the window
var() int WinLeft,WinTop,WinWidth,WinHeight;
// Whether the WRI should destroy itself when the window closes
// - default is true
// - should be set to false if you plan to open/close the window repeatedly
var() bool DestroyOnClose;
// Client Side Variables
// Holds a pointer to the window
var UWindowWindow TheWindow;
// Ticks passed since the creation of the uwindows root (counts up to two)
var int TicksPassed;
replication
{
// Functions that Server calls on the Client
reliable if ( Role == ROLE_Authority)
OpenWindow, CloseWindow;
// Function the Client calls on the Server
reliable if ( Role < ROLE_Authority )
DestroyWRI;
}
// Post(Net)BeginPlay - This is a simulated function that is called everywhere, and creates a window on the appropriate machine.
// Intended for the user attempting to create the window
// The OpenWindow should only be called from one place: the owner's machine.
// To detect when we are on the owner's machine, we check the playerpawn's Player var, and their console.
// Since these only exist on the machine for which they are used,
// their existence ensures we are running on the owner's machine.
// Once that has been validated, we call OpenWindow.
// The reason for BOTH the PostNetBeginPlay and PostBeginPlay is slightly strange.
// PostBeginPlay is called on the client if it is simulated, but it is before the variables have been replicated
// Thus, Owner is not replicated yet, and the WRI is unable to spawn the window
// PostNetBeginPlay is called after the variables have been replicated, and so is appropriate
// It is not called on the server machine (NM_Standalone or NM_Listen) because no variables are replicated to that machine
// And so, PostBeginPlay is needed for those types of servers
event PostBeginPlay()
{
Super.PostBeginPlay();
OpenIfNecessary();
}
simulated event PostNetBeginPlay ()
{
Super.PostBeginPlay();
OpenIfNecessary();
}
simulated function OpenIfNecessary ()
{
local PlayerPawn P;
if (Owner!=None)
{
P = PlayerPawn(Owner);
if (P!=None && P.Player!=None && P.Player.Console !=None)
{
OpenWindow();
}
}
}
// OpenWindow - This is a client-side function who's job is to open on the window on the client.
// Intended for the user attempting to create the window
// This first does a lot of checking to make sure the player has a console.
// Then it creates and sets up UWindows if it has not been set up yet.
// This can take a long period of time, but only happens if you join from GameSpy.
// (eg: connect to a server without using the uwindows stuff to do it)
// Then it sets up bQuickKeyEnable so that the menu/status bar don't show up.
// And finally, says to launch the window two ticks from the call to OpenWindow.
// If the Root could have been created this tick, then it does not contain the height and width
// vars that are necessary to position the window correctly.
simulated function bool OpenWindow()
{
local PlayerPawn P;
local WindowConsole C;
P = PlayerPawn(Owner);
if (P==None)
{
log("#### -- Attempted to open a window on something other than a PlayerPawn");
DestroyWRI();
return false;
}
C = WindowConsole(P.Player.Console);
if (C==None)
{
Log("#### -- No Console");
DestroyWRI();
return false;
}
if (!C.bCreatedRoot || C.Root==None)
{
// Tell the console to create the root
C.CreateRootWindow(None);
}
// Hide the status and menu bars and all other windows, so that our window alone will show
C.bQuickKeyEnable = true;
C.LaunchUWindow();
//tell tick() to create the window in 2 ticks from now, to allow time to get the uwindow size set up
TicksPassed = 1;
return true;
}
// Tick - Counts down ticks in TickPassed until they hit 0, at which point it really creates the window
// Also destroys the WRI when they close the window if DestroyOnClose == true
// Intended for the user attempting to create the window, or close the window
// See the description for OpenWindow for the reasoning behind this Tick.
// After two ticks, it creates the window in the base Root, and sets it up to work with bQuickKeyEnable.
// This also calls DestroyWRI if the WRI is setup to DestroyOnClose, and the window is closed
simulated function Tick(float DeltaTime)
{
if (TicksPassed != 0)
{
if (TicksPassed++ == 2)
{
SetupWindow();
// Reset TicksPassed to 0
TicksPassed = 0;
}
}
if (DestroyOnClose && TheWindow != None && !TheWindow.bWindowVisible)
{
DestroyWRI();
}
}
simulated function bool SetupWindow ()
{
local WindowConsole C;
C = WindowConsole(PlayerPawn(Owner).Player.Console);
TheWindow = C.Root.CreateWindow(WindowClass, WinLeft, WinTop, WinWidth, WinHeight);
if (TheWindow==None)
{
Log("#### -- CreateWindow Failed");
DestroyWRI();
return false;
}
if ( C.bShowConsole )
C.HideConsole();
// Make it show even when everything else is hidden through bQuickKeyEnable
TheWindow.bLeaveOnScreen = True;
// Show the window
TheWindow.ShowWindow();
return true;
}
// CloseWindow -- This is a client side function that can be used to close the window.
// Intended for the user attempting to create the window
// Undoes the bQuickKeyEnable stuff just in case
// Then turns off the Uwindow mode, and closes the window.
simulated function CloseWindow()
{
local WindowConsole C;
C = WindowConsole(PlayerPawn(Owner).Player.Console);
C.bQuickKeyEnable = False;
C.CloseUWindow();
if (TheWindow!=None)
{
TheWindow.Close();
}
}
// ==========================================================================
// These functions happen on the server side
// ==========================================================================
// DestoryWRI - Gets rid of the WRI and cleans up.
// Intended for the server or authority, which *could* be the user that had the window (in a listen server or standalone game)
// Should be called from the client when the user closes the window.
// Subclasses should override it and do any last minute processing of the data here.
function DestroyWRI()
{
Destroy();
}
// Make sure any changes to the WindowClass get replicated in the first Tick of it's lifetime
// Ahead of everything else (UT uses a max of 3)
// Use SimulatedProxy so that the Tick() calls are executed
defaultproperties
{
DestroyOnClose=True
RemoteRole=ROLE_SimulatedProxy
NetPriority=10.00
}
Code: Select all
//=============================================================================
// ACEM_WRI
//
//- The child class of WRI responsible for popping of ACEManager_MainWindow
//- The banned playerlist is replicated here
//=============================================================================
class ACEM_WRI expands WRI;
var string BannedPlayerName[200];
var ACEM_Mut Mut;
var string DefFileVer;
var bool bAllowEveryOnetoSnap, bBanAdmin;
var string CountryFlagsPackage;
var bool bStopReplication;
var ACEM_BanManager ACEBan;
replication
{
// Variables the server should send to the client.
reliable if( Role==ROLE_Authority && !bStopReplication )
BannedPlayerName,bAllowEveryOnetoSnap,DefFileVer,CountryFlagsPackage,bBanAdmin;
//function server calls on client
reliable if( Role==ROLE_Authority )
UpdateCurrPlayers;
}
simulated function bool SetupWindow ()
{
settimer(1,false);
class'ACEManager_MainWindow'.default.FileDefVer = DefFileVer;
class'ACEM_SShot'.default.bAllowEveryOnetoSnap = bAllowEveryOnetoSnap;
class'ACEM_SShot'.default.bBanAdmin = bBanAdmin;
class'ACEM_PlayerInfoListBox'.default.CountryFlagsPackage = CountryFlagsPackage;
class'ACEManager_MainWindow'.default.bBanAdmin = bBanAdmin;
Super.SetupWindow();
}
simulated function UpdateCurrPlayers()
{
ACEManager_MainWindow(TheWindow.FirstChildWindow).ACEShot.CurrPlayerList.bChanged = true;
ACEBan = ACEManager_MainWindow(TheWindow.FirstChildWindow).ACEBan;
if( ACEBan != none )
ACEBan.CurrPlayerList.bChanged = true;
}
simulated function timer()
{
local int i;
ACEManager_MainWindow(TheWindow.FirstChildWindow).ACEBan.BannedPlayerList.Refresh();
for(i=0; i<200; i++)
{
if( BannedPlayerName[i] != "")
ACEManager_MainWindow(TheWindow.FirstChildWindow).AddBannedPlayerInfo( BannedPlayerName[i], i);
}
bStopReplication = true;
}
defaultproperties
{
WindowClass=Class'ACEM_Window' //Here you should write your Uwindow class which you want to be popped
WinLeft=50
WinTop=30
WinWidth=550
WinHeight=500
}
Code: Select all
function OpenACEMGUI( PlayerPawn Sender )
{
local ACEM_WRI A,AMWRI;
foreach AllActors(class'ACEM_WRI',A) // check all existing WRIs
{
if(Sender == A.Owner)
return; // dont open if already open
}
AMWRI = Spawn(class'ACEM_WRI',Sender,,Sender.Location);
if(AMWRI==None)
{
Log("[ACEM"$Version$"] PostLogin :: Fail:: Could not spawn WRI");
return;
}
}
EDIT by papercoffee............................... Avoid double posts please.
Now I see the date of the post ...Gosh it is 2:20 Am here much too late to stay awake ...sorry
For designing UWindows you should see live examples from mods themselves.Here are some of them
1)Admin Tool by [os]sphx
2)BDB's Mapvote
3)ACEManager
Patreon: https://www.patreon.com/FreeandOpenFeralidragon wrote:Trial and error is sometimes better than any tutorial, because we learn how it works for ourselfs, which kills any doubts about anything
Re: UWindow
thanks for that, helped me, but i want the window to pop up in the game, cuz with bdbmapvote and ace i have to press ESC (UT desktop) to see it while MapvoteLA13 pops up in the game. and i cant look in MapvoteLA13's code
-
- Inhuman
- Posts: 958
- Joined: Wed Mar 31, 2010 9:02 pm
- Personal rank: I am quite rank.
- Location: MrLoathsome fell out of the world!
Re: UWindow
With bdbmapvote running, the command "Mutate bdbmapvote votemenu" should popup the window in game.
blarg
Re: UWindow
well thats weird, i can only see it if i go to the desktop, however with LA13 it is OK. Im gonna try on my pc's UT and see if i have it there too, but tomorrow its 4oclock night here :p time to sleep
Re: UWindow
if your still interrested.
I am building a mod in which you can open a window by pressing a key.
I can send it to you if you want?
I am building a mod in which you can open a window by pressing a key.
I can send it to you if you want?
- EvilGrins
- Godlike
- Posts: 9769
- Joined: Thu Jun 30, 2011 8:12 pm
- Personal rank: God of Fudge
- Location: Palo Alto, CA
- Contact:
Re: UWindow
Hit 'Prince Screen' button, then paste it into a painting program.>@tack!< wrote:sorry making SS with my laptop is somehow working weird. but i think i know what to do i just have to know how to open the windowconsole of a player in script, anyone?
http://unreal-games.livejournal.com/
Smilies · viewtopic.php?f=8&t=13758medor wrote:Replace Skaarj with EvilGrins
Re: UWindow
Here's an example that I downloaded years ago to learn how to get the UWindow stuff to work. See
CPan