本文整理汇总了C#中GUI类的典型用法代码示例。如果您正苦于以下问题:C# GUI类的具体用法?C# GUI怎么用?C# GUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GUI类属于命名空间,在下文中一共展示了GUI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
Application.Init ();
GUI gui = new GUI ();
gui.Show ();
Application.Run ();
}
示例2: Add
public void Add(string name, GUI.WindowFunction f)
{
Tab t = new Tab ();
t.name = name;
t.f = f;
Add (t);
}
示例3: GameUIManager
public GameUIManager()
{
UIMain uiMain = LKernel.GetG<UIMain>();
//This mess gets the height and width of the window for centering UI entities.
uint uheight, uwidth, colorDepth;
int height, width;
RenderWindow window = LKernel.GetG<RenderWindow>();
window.GetMetrics(out uwidth, out uheight, out colorDepth);
width = (int)uwidth;
height = (int)uheight;
inGameUI = uiMain.GetGUI("ingame gui");
itembox = inGameUI.GetControl<PictureBox>("itembox");
//itembox.Top = (height / 2);
//itembox.Bottom = (height / 2);
//itembox.Left = (width / 2);
//itembox.Right = (width / 2);
itemimage = inGameUI.GetControl<PictureBox>("itemimage");
//itemimage.Top = (height / 2);
//itemimage.Bottom = (height / 2);
//itemimage.Left = (width / 2);
//itemimage.Right = (width / 2);
}
示例4: Awake
// Use this for initialization
void Awake()
{
Instantiate(BackgroundPrefab, new Vector3(0, 0, 0), transform.rotation);
Instantiate(ClockwiseCog, new Vector3(1.28f, 0.218f, 0), transform.rotation);
Instantiate(ClockwiseCog, new Vector3(-0.925f, -0.073f, 0), transform.rotation);
Instantiate(CounterclockwiseCog, new Vector3(0.871f, 0.315f, 0), transform.rotation);
Instantiate(CounterclockwiseCog, new Vector3(-0.819f, 0.344f, 0), transform.rotation);
Instantiate(SmallPlatformPrefab, middlePlatformPosition, transform.rotation);
Instantiate(SmallPlatformPrefab, leftPlatformPosition, transform.rotation);
Instantiate(SmallPlatformPrefab, rightPlatformPosition, transform.rotation);
Instantiate(LargePlatformPrefab, basePlatformPosition, transform.rotation);
Instantiate(DeadlyFloorPrefab, deadlyFloorPosition, transform.rotation);
Instantiate(WallPrefab, leftFloorPosition, transform.rotation);
Instantiate(WallPrefab, rightFloorPosition, transform.rotation);
gui = ((Transform)Instantiate(GuiPrefab, transform.position, transform.rotation)).GetComponent<GUI>();
var playerOne = (Transform)Instantiate(NinjaPrefab, playerOneSpawningPoints[playerOneSpawningIndex], transform.rotation);
var playerTwo = (Transform)Instantiate(GuyPrefab, playerTwoSpawningPoints[playerTwoSpawningIndex], transform.rotation);
playerOneController = playerOne.GetComponent<PlayerController>();
playerTwoController = playerTwo.GetComponent<PlayerController>();
playerOneMeta = InitMeta(playerOne, "Ninja", PlayerID.P1);
playerTwoMeta = InitMeta(playerTwo, "Thug", PlayerID.P2);
}
示例5: Form_lireVariable
public Form_lireVariable(GUI parent, String nomVariable)
{
InitializeComponent();
this.leChoixEstFait = false;
this.parent = parent;
}
示例6: preliminarySetup
public static void preliminarySetup(GUI gui)
{
PanelControls.setupFlag = true;
PlayerResources.gameState = new GameState(); //create brand new game
//populate button list
gui.buttonList = ButtonControls.populateButtons(gui);
//set status bar
gui.turnStatus.Text = "Turn: Player " + PlayerResources.gameState.currentPlayer;
PlayerResources.gameState.currentPlayer = 1;
//place players in corners
InitialSetups.placePlayersInCorners(gui);
ButtonControls.setCursorsForNextTurn(gui);
PanelControls.setupFlag = false; //declare end of setup
LoadSave.loadFlag = false; //declare end of game load
GamePlayerFunctions.availableAction = true;
//update player credits
//give all players an initial income of 2000 credits
PlayerResources.gameState.initialIncome(2000);
gui.creditsBox.Text = "" + PlayerResources.gameState.selectCurrentPlayer().goldCount;
gui.infoBox.Text = " Welcome. " + PlayerResources.gameState.player1.getName() + "'s \n turn.";
}
示例7: Start
// Use this for initialization
void Start()
{
Debug.Log("start scored");
SharedBehaviour.current.score = 115;
menu = GameObject.FindGameObjectWithTag("menuRoot").GetComponent<GUI>();
menu.state = "highscores";
}
示例8: Main
static void Main(string[] args)
{
// initialize window and view
win = new RenderWindow(new VideoMode(1000, 700), "Hadoken!!!");
view = new View();
resetView();
gui = new GUI(win, view);
// exit Program, when window is being closed
//win.Closed += new EventHandler(closeWindow);
win.Closed += (sender, e) => { (sender as Window).Close(); };
// initialize GameState
handleNewGameState();
// initialize GameTime
GameTime gameTime = new GameTime();
gameTime.Start();
// debug Text
Text debugText = new Text("debug Text", new Font("Fonts/calibri.ttf"));
while (running && win.IsOpen())
{
KeyboardInputManager.update();
currentGameState = state.update();
// gather draw-stuff
win.Clear(new Color(100, 149, 237)); //cornflowerblue ftw!!! 1337
state.draw(win, view);
state.drawGUI(gui);
// first the state must be drawn, before I can change the currentState
if (currentGameState != prevGameState)
{
handleNewGameState();
}
// do the actual drawing
win.SetView(view);
win.Display();
// check for window-events. e.g. window closed
win.DispatchEvents();
// update GameTime
gameTime.Update();
float deltaTime = (float)gameTime.EllapsedTime.TotalSeconds;
// idleLoop for fixed FrameRate
float deltaPlusIdleTime = deltaTime;
while (deltaPlusIdleTime < (1F / fixedFps))
{
gameTime.Update();
deltaPlusIdleTime += (float)gameTime.EllapsedTime.TotalSeconds;
}
Console.WriteLine("real fps: " + (int)(1F / deltaPlusIdleTime) + ", theo fps: " + (int)(1F / deltaTime));
}
}
示例9: InvoiceControl
public InvoiceControl( Invoice invoice, House house, GUI gui )
{
this.invoice = invoice;
this.gui = gui;
this.house = house;
InitializeComponent();
}
示例10: PauseUIHandler
public PauseUIHandler()
{
pauseGui = LKernel.GetG<UIMain>().GetGUI("pause gui");
// hook up to the pause event
LKernel.GetG<Pauser>().PauseEvent += new PauseEvent(DoOnPause);
}
示例11: RaceResultUIHandler
public RaceResultUIHandler()
{
winnerGui = LKernel.Get<UIMain>().GetGUI("winner gui");
winnerLabel = winnerGui.GetControl<Label>("winner label");
LapCounter.OnFirstFinish += new RaceFinishEvent(OnFirstFinish);
winnerGui.Visible = false;
}
示例12: LoadingUIHandler
public LoadingUIHandler()
{
LevelManager.OnLevelPostLoad += OnLevelPostLoad;
LevelManager.OnLevelPreUnload += OnLevelPreUnload;
loadingGui = LKernel.GetG<UIMain>().GetGUI("loading screen gui");
}
示例13: DrawResizeableWindow
public static Rect DrawResizeableWindow(Rect drawRect, int id, GUI.WindowFunction func)
{
Rect dragArea = new Rect(drawRect.x - 8, drawRect.y - 8, drawRect.width, drawRect.height);
int gid = EditorGUIUtility.GetControlID(FocusType.Native);
Event e = Event.current;
switch (e.GetTypeForControl(gid))
{
case EventType.MouseDown:
{
if (drawRect.Contains(e.mousePosition)) // inside this control
{
EditorGUIUtility.hotControl = gid;
Resizing = true;
e.Use();
Debug.Log("USED");
}
}
break;
case EventType.MouseUp:
{
Resizing = false;
e.Use();
}
break;
}
return drawRect;
//func.Invoke(id);
}
示例14: Start
// Use this for initialization
void Start()
{
hsTable = GameObject.FindGameObjectWithTag("highScoreText").GetComponent<GUIText>();
hsTable.text = "";
userInput = GameObject.FindGameObjectWithTag("userInput"); //.GetComponent<GUIText>()
menu = GameObject.FindGameObjectWithTag("menuRoot").GetComponent<GUI>() as GUI;
userPrompt = GameObject.FindGameObjectWithTag("userPrompt"); //.GetComponent<GUIText>();
// off at first
userPrompt.SetActive(false);
userInput.SetActive(false);
// get the data
var data = PlayerPrefs.GetString("HighScores");
if(!string.IsNullOrEmpty(data)) {
var b = new BinaryFormatter();
// create a new memory stream with the data
var m = new MemoryStream(Convert.FromBase64String(data));
highScores = (List<ScoreEntry>)b.Deserialize(m);
}else {
highScores.Add(new ScoreEntry{name = "SomePlayer",score = 10});
}
// sort the values we pulled from the player prefs
highScores = highScores.OrderByDescending(o=>o.score).ToList();
Debug.Log("scores in start: "+ highScores.Count());
}
示例15: Game
// Constructor for Game
public Game()
{
board = new Board();
fileMonitor = new FileMonitor();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
gui = new ChessForms.GUI(start, pauseUnpause, reset, saveGame, loadGame);
// Load last game
bool ok = SaveManager.loadCurrent(ref board);
if (ok)
{
// Set GUI and other stuff
gui.putString("Loading last game");
updateOnLoad();
}
else
{
reset();
}
gui.updateBoard(board);
Application.Run(gui);
}