Unity3D导出exe窗口参数调整培训
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Unity3D导出exe窗口参数调整培训,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含5637字,纯文字阅读大概需要9分钟。
内容图文
![Unity3D导出exe窗口参数调整培训](/upload/InfoBanner/zyjiaocheng/1137/68f4ec367bd044e08ae5e20959106b01.jpg)
欢迎来到unity学习、unity培训、unity企业培训教育专区,这里有很多U3D资源、U3D培训视频、U3D教程、U3D常见问题、U3D项目源码,我们致力于打造业内unity3d培训、学习第一品牌。
下面我们开始今天的Unity3D技能培训。 我们学习Unity3D培训目标:让U3D初学者可以更快速的掌握U3D技术,自行制作修改素材,可以独立完成2D、3D小规模游戏及网页游戏开发。
[csharp] view plaincopy
-
using System;
-
using System.Runtime.InteropServices;
-
using UnityEngine;
-
public class WindowMod : MonoBehaviour
-
{
-
public enum appStyle
-
{
-
FullScreen,
-
WindowedFullScreen,
-
Windowed,
-
WindowedWithoutBorder
-
}
-
public enum zDepth
-
{
-
Normal,
-
Top,
-
TopMost
-
}
-
private const uint SWP_SHOWWINDOW = 64u;
-
private const int GWL_STYLE = -16;
-
private const int WS_BORDER = 1;
-
private const int GWL_EXSTYLE = -20;
-
private const int WS_CAPTION = 12582912;
-
private const int WS_POPUP = 8388608;
-
private const int SM_CXSCREEN = 0;
-
private const int SM_CYSCREEN = 1;
-
public WindowMod.appStyle AppWindowStyle = WindowMod.appStyle.WindowedFullScreen;
-
public WindowMod.zDepth ScreenDepth;
-
public int windowLeft = 10;
-
public int windowTop = 10;
-
public int windowWidth = 800;
-
public int windowHeight = 600;
-
private Rect screenPosition;
-
private IntPtr HWND_TOP = new IntPtr(0);
-
private IntPtr HWND_TOPMOST = new IntPtr(-1);
-
private IntPtr HWND_NORMAL = new IntPtr(-2);
-
private int Xscreen;
-
private int Yscreen;
-
private int i;
-
[DllImport("user32.dll")]
-
private static extern IntPtr GetForegroundWindow();
-
[DllImport("user32.dll", CharSet = CharSet.Auto)]
-
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hPos, int x, int y, int cx, int cy, uint nflags);
-
[DllImport("User32.dll")]
-
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
-
[DllImport("User32.dll")]
-
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
-
[DllImport("User32.dll")]
-
private static extern int GetWindowLong(IntPtr hWnd, int dwNewLong);
-
[DllImport("User32.dll")]
-
private static extern bool MoveWindow(IntPtr hWnd, int x, int y, int width, int height, bool repaint);
-
[DllImport("user32.dll", CharSet = CharSet.Auto)]
-
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
-
[DllImport("user32.dll", CharSet = CharSet.Auto)]
-
public static extern int SendMessage(IntPtr hwnd, int msg, IntPtr wP, IntPtr IP);
-
[DllImport("user32.dll", CharSet = CharSet.Auto)]
-
public static extern IntPtr SetParent(IntPtr hChild, IntPtr hParent);
-
[DllImport("user32.dll", CharSet = CharSet.Auto)]
-
public static extern IntPtr GetParent(IntPtr hChild);
-
[DllImport("User32.dll")]
-
public static extern IntPtr GetSystemMetrics(int nIndex);
-
private void Start()
-
{
-
this.Xscreen = (int)WindowMod.GetSystemMetrics(0);
-
this.Yscreen = (int)WindowMod.GetSystemMetrics(1);
-
if (this.AppWindowStyle == WindowMod.appStyle.FullScreen)
-
{
-
Screen.SetResolution(this.Xscreen, this.Yscreen, true);
-
}
-
if (this.AppWindowStyle == WindowMod.appStyle.WindowedFullScreen)
-
{
-
Screen.SetResolution(this.Xscreen - 1, this.Yscreen - 1, false);
-
this.screenPosition = new Rect(0f, 0f, (float)(this.Xscreen - 1), (float)(this.Yscreen - 1));
-
}
-
if (this.AppWindowStyle == WindowMod.appStyle.Windowed)
-
{
-
Screen.SetResolution(this.windowWidth, this.windowWidth, false);
-
}
-
if (this.AppWindowStyle == WindowMod.appStyle.WindowedWithoutBorder)
-
{
-
Screen.SetResolution(this.windowWidth, this.windowWidth, false);
-
this.screenPosition = new Rect((float)this.windowLeft, (float)this.windowTop, (float)this.windowWidth, (float)this.windowWidth);
-
}
-
}
-
private void Update()
-
{
-
if (this.i < 5)
-
{
-
if (this.AppWindowStyle == WindowMod.appStyle.WindowedFullScreen)
-
{
-
WindowMod.SetWindowLong(WindowMod.GetForegroundWindow(), -16, 369164288);
-
if (this.ScreenDepth == WindowMod.zDepth.Normal)
-
{
-
WindowMod.SetWindowPos(WindowMod.GetForegroundWindow(), this.HWND_NORMAL, (int)this.screenPosition.x, (int)this.screenPosition.y, (int)this.screenPosition.width, (int)this.screenPosition.height, 64u);
-
}
-
if (this.ScreenDepth == WindowMod.zDepth.Top)
-
{
-
WindowMod.SetWindowPos(WindowMod.GetForegroundWindow(), this.HWND_TOP, (int)this.screenPosition.x, (int)this.screenPosition.y, (int)this.screenPosition.width, (int)this.screenPosition.height, 64u);
-
}
-
if (this.ScreenDepth == WindowMod.zDepth.TopMost)
-
{
-
WindowMod.SetWindowPos(WindowMod.GetForegroundWindow(), this.HWND_TOPMOST, (int)this.screenPosition.x, (int)this.screenPosition.y, (int)this.screenPosition.width, (int)this.screenPosition.height, 64u);
-
}
-
WindowMod.ShowWindow(WindowMod.GetForegroundWindow(), 3);
-
}
-
if (this.AppWindowStyle == WindowMod.appStyle.Windowed)
-
{
-
if (this.ScreenDepth == WindowMod.zDepth.Normal)
-
{
-
WindowMod.SetWindowPos(WindowMod.GetForegroundWindow(), this.HWND_NORMAL, 0, 0, 0, 0, 3u);
-
WindowMod.SetWindowPos(WindowMod.GetForegroundWindow(), this.HWND_NORMAL, 0, 0, 0, 0, 35u);
-
}
-
if (this.ScreenDepth == WindowMod.zDepth.Top)
-
{
-
WindowMod.SetWindowPos(WindowMod.GetForegroundWindow(), this.HWND_TOP, 0, 0, 0, 0, 3u);
-
WindowMod.SetWindowPos(WindowMod.GetForegroundWindow(), this.HWND_TOP, 0, 0, 0, 0, 35u);
-
}
-
if (this.ScreenDepth == WindowMod.zDepth.TopMost)
-
{
-
WindowMod.SetWindowPos(WindowMod.GetForegroundWindow(), this.HWND_TOPMOST, 0, 0, 0, 0, 3u);
-
WindowMod.SetWindowPos(WindowMod.GetForegroundWindow(), this.HWND_TOPMOST, 0, 0, 0, 0, 35u);
-
}
-
}
-
if (this.AppWindowStyle == WindowMod.appStyle.WindowedWithoutBorder)
-
{
-
WindowMod.SetWindowLong(WindowMod.GetForegroundWindow(), -16, 369164288);
-
if (this.ScreenDepth == WindowMod.zDepth.Normal)
-
{
-
WindowMod.SetWindowPos(WindowMod.GetForegroundWindow(), this.HWND_NORMAL, (int)this.screenPosition.x, (int)this.screenPosition.y, (int)this.screenPosition.width, (int)this.screenPosition.height, 64u);
-
}
-
if (this.ScreenDepth == WindowMod.zDepth.Top)
-
{
-
&
更多精彩请点击 http://www.gopedu.com/
原文:http://www.cnblogs.com/Unity3Dqishituan/p/4022821.html
内容总结
以上是互联网集市为您收集整理的Unity3D导出exe窗口参数调整培训全部内容,希望文章能够帮你解决Unity3D导出exe窗口参数调整培训所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。