Icon Improvement Concept & Resizeable Window (#104)

* Editor: mostly PoC icon effects

* slightly more responsive selection

* resizeable window

game camera still doesn't letterbox properly, will need a bit more work

* letterbox both in editor and in fullscreen

* restore camera rects when returning to editor
This commit is contained in:
minenice55 2022-06-14 01:24:41 -04:00 committed by GitHub
parent b660b4dcbd
commit 342f3d6771
47 changed files with 2388 additions and 3420 deletions

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2a99a58e442018348acfd830201109e4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d1d966b9431ac784c83edb4620eef80f
folderAsset: yes
timeCreated: 1456245966
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,186 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>Letterbox Ratio Doc</title>
<style type="text/css">
body {
border: none;
font-family: Arial,Helvetica,sans-serif;
font-size: 1em;
line-height: 1em;
color: black;
background-color: #fdf9f1;
display: block;
}
</style>
<script language="javascript"> function toggle(togglableText, title) {
var ele = document.getElementById(togglableText);
var text = document.getElementById(title);
if(ele.style.display == "block") {
ele.style.display = "none";
}
else {
ele.style.display = "block";
}
} </script>
</head>
<body>
<h1 style="text-align: center;"><span style="font-family: Helvetica,Arial,sans-serif;"></span>Auto Letterbox Plugin</h1>
<div style="margin-left: 40px;">Welcome to the Auto Letterbox Plugin, for fixing your Camera Aspect Ratio! The fastest way to get started is to go to the <span style="text-decoration: underline;"><span style="font-weight: bold;">GameObject</span></span>
menu and click <span style="text-decoration: underline;"><span style="font-weight: bold;">Create Force Camera Ratios Object</span></span>.<br>
This will set your scene up for displaying in a set
ratio (<span style="font-style: italic;">Target Viewport
Ratio</span>) by creating Letterboxes to fit your Screen. You can
edit the system using the 'Force Camera Ratios' GameObject you've just
created.<br>
<br>
This documentation will delve into the rest of the options you have on
the Component.</div>
<p style="text-align: center;"><img style="border: 1px solid ; width: 1101px; height: 546px;" alt="" title="Clicking the &quot;Create Force Camera Ratios Object&quot; Button under the GameObject Menu is the fastest way to get started" src="Imgs/CreatePic.png" hspace="3" vspace="3"></p>
<table style="width: 90%; height: 166px; text-align: left; margin-left: auto; margin-right: auto;" border="2" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td>
<h2 style="text-align: left; margin-left: 40px;"><a style="font-family: Helvetica,Arial,sans-serif; color: rgb(127, 118, 102); font-weight: bold;" id="displayText1" href="javascript:toggle('toggleText1', 'displayText1');">Standard
Use</a></h2>
<div id="toggleText1" style="display: none;">
<div style="text-align: center;">
<div style="text-align: left;"><img style="width: 356px; height: 76px; float: right;" alt="" src="Imgs/Setup.png">&nbsp;&nbsp;&nbsp; <span style="font-weight: bold; text-decoration: underline;">Target
Viewport Ratio<br>
</span>A Vector2 which sets the Viewport ratio for all
Cameras. You can set this using the provided interface or access this
publically and safely in code. The default is 16:9.<br>
<br>
&nbsp;&nbsp;&nbsp; <span style="text-decoration: underline;"><span style="font-weight: bold;">Ratio on Awake<br>
</span></span>Forces each Camera Viewport to a
re-calculated Viewport when this components' <span style="font-style: italic;">Start()</span> function
runs at
the start of the scene. By default this is on as other-wise you would
have to call <span style="font-style: italic;">CalculateAndSetAllCameraRatios()</span>
through your own code (though
this function can be called at any time).<span style="text-decoration: underline;"><span style="font-weight: bold;"><span style="text-decoration: underline;"><span style="font-weight: bold;"><br>
<br>
</span></span></span></span>&nbsp;&nbsp;&nbsp;
<span style="text-decoration: underline;"><span style="font-weight: bold;">Ratio in Realtime</span></span><br>
Forces each Camera Viewport to recalculate its Viewport every frame.
This is useful if you wish to change the <span style="font-style: italic;">Target Viewport Ratio</span>
in real
time or if you allow the user to resize the Game window.</div>
</div>
</div>
</td>
</tr>
<tr>
<td>
<h2 style="text-align: left; margin-left: 40px;"><a style="font-family: Helvetica,Arial,sans-serif; color: rgb(127, 118, 102); font-weight: bold;" id="displayText2" href="javascript:toggle('toggleText2', 'displayText2');">Letterbox
Camera</a></h2>
<div id="toggleText2" style="display: none;">
<div style="text-align: center;">
<div style="text-align: left;"><img style="width: 367px; height: 49px; float: right;" alt="" src="Imgs/AutoCreateBorderCam.png"> The Letterbox Camera
renders the bars at the sides of the screen which appear when
the&nbsp;<span style="font-style: italic;">Target
Viewport Ratio</span> doesn't match the screen ratio. Not having
a Letterbox Camera could cause ugly artefacts when changing the screen
size or altering the camera ratio.<br>
<br>
There are two ways of creating a Letterbox Camera:<br>
&nbsp;&nbsp;&nbsp; <span style="text-decoration: underline;"><span style="font-weight: bold;">Automatically Create Border Camera<br>
</span></span>When <span style="font-style: italic;">Create Border Camera</span>
is true a Letterbox Camera will automatically be created on <span style="font-style: italic;">Start()</span> at a depth
of -100 and render to a color of your choosing. This is the default
option.<br>
<br>
<img style="width: 367px; height: 48px; float: right;" alt="" src="Imgs/CustomBorderCam.png">&nbsp;&nbsp;&nbsp;
<span style="text-decoration: underline;"><span style="font-weight: bold;">Custom Letterbox Camera</span></span><br>
When <span style="font-style: italic;">Create Border
Camera</span> is false you must assign your own in-scene Camera
to be a Letterbox Camera. This Camera will be ignored by the <span style="font-style: italic;">FindAllCamerasInScene()</span>
function so you can do whatever you want with it's viewport. This is
useful if you want to do something clever with your Letterbox bars like
render an image in the empty space (For an example try the <span style="font-style: italic;">Bitey Dragon</span> Demo
scene included with the package.)</div>
</div>
</div>
</td>
</tr>
<tr>
<td>
<h2 style="text-align: left; margin-left: 40px;"><a style="font-family: Helvetica,Arial,sans-serif; color: rgb(127, 118, 102); font-weight: bold;" id="displayText3" href="javascript:toggle('toggleText3', 'displayText3');">Managing
your Cameras</a></h2>
<div id="toggleText3" style="display: none;">
<div style="text-align: center;">
<div style="text-align: left;"><img style="width: 360px; height: 67px; float: right;" alt="" src="Imgs/AutoSeekCameras.png">&nbsp;&nbsp;&nbsp;
<span style="font-weight: bold; text-decoration: underline;">Auto
seek Cameras<br>
</span>When <span style="font-style: italic;">Auto
seek Cameras</span> is true, the <span style="font-style: italic;">Force Camera Ratios</span>
component will search for cameras in your scene on <span style="font-style: italic;">Start()</span> and apply
the same Viewport anchor&nbsp;to each. This is the default setting.<br>
<br>
&nbsp;&nbsp;&nbsp; <span style="text-decoration: underline;"><span style="font-weight: bold;">Manual Camera Managment</span></span><img style="width: 360px; height: 340px; float: left;" alt="" src="Imgs/FinAllCameras.png"><br>
When <span style="font-style: italic;">Auto seek Cameras</span>
is false, you may manually assign and manage each Camera that needs
Letterboxing. The <span style="font-style: italic;">Find
All Cameras in scene</span> button will call <span style="font-style: italic;">FindAllCamerasInScene()</span>
filling the Camera array quickly and defaulting each Camera Anchor to <span style="font-style: italic;">Center.</span><span style="text-decoration: underline;"><span style="font-weight: bold;"><span style="text-decoration: underline;"><span style="font-weight: bold;"></span></span></span></span><span style="text-decoration: underline;"><span style="font-weight: bold;"><br>
<br>
</span></span><span style="font-weight: bold;"><span style="font-weight: bold;">&nbsp; &nbsp; </span></span><span style="font-weight: bold; text-decoration: underline;"><span style="font-weight: bold;"></span>Camera Anchor<br>
</span>The <span style="font-style: italic;">Anchor
</span>enum anchors each camera when its' resized due to a
viewport ratio recalculation. This is useful for when you have multiple
cameras on screen, for example, split screen multiplayer. By setting up
Player one's and Player two's Viewports adjacently and setting their
respective Anchors to <span style="font-style: italic;">Left</span>
and <span style="font-style: italic;">Right</span>,
the plug-in will re-calculate their ratio and seamlessly keep their
Viewports to the left and right of each other. It works similarly to
Unitys' UI Anchoring system.<br>
<br>
(For an example of this in action, try the <span style="font-style: italic;">Multi Camera Demo </span>scene
included with the package.)<br>
</div>
</div>
</div>
</td>
</tr>
<tr>
<td>
<h2 style="text-align: left; margin-left: 40px;"><a style="font-family: Helvetica,Arial,sans-serif; color: rgb(127, 118, 102); font-weight: bold;" id="displayText4" href="javascript:toggle('toggleText4', 'displayText4');">Contact</a></h2>
<div id="toggleText4" style="display: none;">
<div style="text-align: center;">
<div style="text-align: left;"><img style="width: 232px; height: 232px; float: right;" alt="" src="Imgs/mug.png">&nbsp;&nbsp;&nbsp; <span style="font-weight: bold; text-decoration: underline;">Stuck?<br>
</span>If you're having trouble or have a question, further
support is available.&nbsp;Feel free to send me an email via <a href="mailto:tom@tomsayshi.com">tom@tomsayshi.com</a>
or tweet at me via <a href="https://twitter.com/Tom_SaysHi">@Tom_SaysHi</a>.<br>
<br>
This document is still a work in progress and your experiences are very
much part of it so don't be shy! Speaking of which;<br>
<br>
&nbsp;&nbsp;&nbsp; <span style="text-decoration: underline;"><span style="font-weight: bold;">Got an Opinion?</span></span><br>
STILL feel free to e-mail me via <a href="mailto:tom@tomsayshi.com">tom@tomsayshi.com&nbsp;</a>or
tweet at me via <a href="https://twitter.com/Tom_SaysHi">@Tom_SaysHi</a>.<br>
<br>
Feedback, good or bad, is always welcome for incorporation into future
updates and products!<br>
<br>
&nbsp;&nbsp;&nbsp; <span style="text-decoration: underline;"><span style="font-weight: bold;">Hey kid, wanna' play some Video
Games?</span></span><br>
I'm just gonna' leave this <a href="http://store.steampowered.com/app/391210/">here</a>.
It's an arena game with laser swords called <span style="font-weight: bold;">Arclight Cascade</span>.
What? It's my docs and I'll plug what I want to!<br>
<br>
<h3 style="text-align: center;"><span style="text-decoration: underline;">Thank you so much for
using the Auto Letterbox Plug-in! I hope you have a swell day!</span></h3>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div style="text-align: center;"><a href="http://tomsayshi.com"><img style="border: 0px solid ; width: 100px; height: 100px; float: right;" alt="" title="Oh to be a smol sensitive boi" src="Imgs/TomRound.png"></a><br>
<a href="http://tomsayshi.com">Written by Tom Elliott 2020</a><br>
tom@tomsayshi.com<br>
<a href="http://littlegrimlight.daportfolio.com/">Bitey Dragon Demo Art by Matthew Seprini</a><br>
</div>
</body></html>

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a78c4b283abe78042bc2c46a182247dd
timeCreated: 1456245967
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 718ba5e4e877593428ce9967f1467376
folderAsset: yes
timeCreated: 1456245966
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: 5902b9337b439e3469b5b14784bbf1ac
timeCreated: 1456245966
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: a0659d40a5adaa54cae4afa7d151ac12
timeCreated: 1456245966
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

View file

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: a1a5f08fe41d99d41a5aae0e5d3ed052
timeCreated: 1456245966
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View file

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: 34a4e878d3a371e4ea35079b7f0241b8
timeCreated: 1456245966
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: 74caa4cb00b2ffc41bdec31b301b34ad
timeCreated: 1456245966
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View file

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: cabc78253c76d3f49b4a86526622193a
timeCreated: 1456245967
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View file

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: fec279ec88a252342b092b7d63bed612
timeCreated: 1456245967
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View file

@ -0,0 +1,92 @@
fileFormatVersion: 2
guid: c757ae881ebd49f4ead172947a2e1ffa
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

View file

@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: bd2b876221f6ff340b5adee4654a8926
timeCreated: 1456245966
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: bb67b1e2487c1394cb27cd848223a71b
folderAsset: yes
timeCreated: 1446637250
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,87 @@
using UnityEngine;
using UnityEditor;
using System.Collections;
using AutoLetterbox;
namespace AutoLetterbox
{
/* ForceCameraRatioEditor.cs
*
* An Editor script for ForceCameraRatio
*
* Originally made by Milo Keeble, source can be found on Github @ https://github.com/Ragepyro/EditorFileMaker */
[CustomEditor(typeof(ForceCameraRatio))]
public class ForceCameraRatioEditor : Editor
{
/// <summary>
/// Create a ForceCameraRatio Object in the current scene
/// </summary>
[MenuItem("GameObject/Create Force Camera Ratios Object", false, 11)]
public static void ForceCameraRatios () {
ForceCameraRatio myCameraForcer = new GameObject("Force Camera Ratios").AddComponent<ForceCameraRatio>();
Selection.activeGameObject = myCameraForcer.gameObject;
Undo.RegisterCreatedObjectUndo(myCameraForcer.gameObject, "Created A ForceCameraRatios Manager Obejct");
}
/// <summary>
/// Display an editor friendly interface for the ForceCameraRatio Component
/// </summary>
public override void OnInspectorGUI () {
ForceCameraRatio myTarget = (ForceCameraRatio)target;
Undo.RecordObject(myTarget, "Force Camera Ratio");
myTarget.ratio = EditorGUILayout.Vector2Field(new GUIContent("Target Viewport Ratio", "The ratio that the Letterbox will display at"), myTarget.ratio);
myTarget.forceRatioOnAwake = EditorGUILayout.Toggle(new GUIContent("Ratio on Awake", "Enable the Letterbox effect automatically on Awake"), myTarget.forceRatioOnAwake);
myTarget.listenForWindowChanges = EditorGUILayout.Toggle(new GUIContent("Ratio in Realtime", "Recalculate the Letterbox effect every time the game window is resized"), myTarget.listenForWindowChanges);
EditorGUILayout.Separator();
// Letterbox Camera
myTarget.createCameraForLetterBoxRendering = EditorGUILayout.Toggle(new GUIContent("Create Border Camera", "Generate a Camera which renders the Letterbox borders"), myTarget.createCameraForLetterBoxRendering);
if (myTarget.createCameraForLetterBoxRendering) {
myTarget.letterBoxCameraColor = EditorGUILayout.ColorField(new GUIContent("Border Color", "The color of the Letterbox borders"), myTarget.letterBoxCameraColor);
} else {
myTarget.letterBoxCamera = (Camera)EditorGUILayout.ObjectField("Letterbox Camera", myTarget.letterBoxCamera, typeof(Camera), true);
if (myTarget.letterBoxCamera == null) {
EditorGUILayout.HelpBox("Without a Letterbox Border Camera, things may render but never clear in the letterbox borders. A generated Border Camera would occupy a Camera depth of -100", MessageType.Warning);
}
}
EditorGUILayout.Separator();
// Registered Cameras for ratio calculation
myTarget.findCamerasAutomatically = EditorGUILayout.Toggle(new GUIContent("Auto seek Cameras", "If true, will automatically find all cameras in scene on Awake"), myTarget.findCamerasAutomatically);
if (myTarget.findCamerasAutomatically) {
EditorGUILayout.HelpBox("Any Cameras that exist in the scene when this script Awakes will be forced to the given aspect ratio", MessageType.Info);
} else {
if (GUILayout.Button("Find All Cameras in scene")) {
myTarget.FindAllCamerasInScene();
}
// If there is no array of cameras (as in null, empty arrays don't count) create one with the cameras in scene
if (myTarget.GetCameras() == null) {
myTarget.FindAllCamerasInScene();
}
// If ther is STILL no array of cameras, just create an empty one
if (myTarget.GetCameras() == null) {
myTarget.cameras = new System.Collections.Generic.List<CameraRatio>();
}
// Display Array of Cameras
SerializedObject serialObj = new SerializedObject(myTarget);
SerializedProperty cams = serialObj.FindProperty("cameras");
EditorGUILayout.PropertyField(cams, true);
serialObj.ApplyModifiedProperties();
EditorGUILayout.HelpBox("Only the Cameras in this array will be forced to the given aspect ratio", MessageType.Info);
}
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 629f2622bb706044d8955aa41abc65da
timeCreated: 1446637256
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,294 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using AutoLetterbox;
namespace AutoLetterbox
{
/* ForceCameraRatio.cs
*
* Forces the assigned Cameras to a given Aspect Ratio by Letterboxing them horizontally or vertically
*
* 2015
* Written by Tom Elliott */
// A class for tracking individual Cameras and their Viewports
[System.Serializable]
public class CameraRatio
{
public enum CameraAnchor
{
Center,
Top,
Bottom,
Left,
Right,
TopLeft,
TopRight,
BottomLeft,
BottomRight
}
[Tooltip("The Camera assigned to have an automatically calculated Viewport Ratio")]
public Camera camera;
[Tooltip("When a Camera Viewport is shrunk to fit a ratio, it will anchor the new Viewport Rectangle at the given point (relative to the original, unshrunk Viewport)")]
public CameraAnchor anchor = CameraAnchor.Center;
[HideInInspector]
public Vector2 vectorAnchor;
private Rect originViewPort;
public CameraRatio (Camera _camera, Vector2 _anchor) {
camera = _camera;
vectorAnchor = _anchor;
originViewPort = camera.rect;
}
/// <summary>
/// Sets the Camera's current Viewport as the viewport measurements to fill on resizing
/// </summary>
public void ResetOriginViewport () {
originViewPort = camera.rect;
SetAnchorBasedOnEnum(anchor);
}
/// <summary>
/// Sets the Anchor for this Camera when it is resized based on a given enum description
/// </summary>
/// <param name="_anchor"></param>
public void SetAnchorBasedOnEnum (CameraAnchor _anchor) {
switch (_anchor) {
case CameraAnchor.Center:
vectorAnchor = new Vector2(0.5f, 0.5f);
break;
case CameraAnchor.Top:
vectorAnchor = new Vector2(0.5f, 1f);
break;
case CameraAnchor.Bottom:
vectorAnchor = new Vector2(0.5f, 0f);
break;
case CameraAnchor.Left:
vectorAnchor = new Vector2(0f, 0.5f);
break;
case CameraAnchor.Right:
vectorAnchor = new Vector2(1f, 0.5f);
break;
case CameraAnchor.TopLeft:
vectorAnchor = new Vector2(0f, 1f);
break;
case CameraAnchor.TopRight:
vectorAnchor = new Vector2(1f, 1f);
break;
case CameraAnchor.BottomLeft:
vectorAnchor = new Vector2(0f, 0f);
break;
case CameraAnchor.BottomRight:
vectorAnchor = new Vector2(1f, 0f);
break;
}
}
/// <summary>
/// Forces a camera to render at a given ratio
/// Creates a letter box effect if the new viewport does not match the current Window ratio
/// </summary>
/// <param name="_targetAspect"></param>
/// <param name="_currentAspect"></param>
public void CalculateAndSetCameraRatio (float _width, float _height, bool _horizontalLetterbox) {
Rect localViewPort = new Rect();
// Force the viewport to a width and height accurate to the target ratio
if (_horizontalLetterbox) { // current aspect is wider than target aspect so shorten down height of the viewport
localViewPort.height = _height;
localViewPort.width = 1;
} else { // current aspect is taller than target aspect so thin down width of the viewport
localViewPort.height = 1f;
localViewPort.width = _width;
}
// Resize and position the viewport to fit in it's original position on screen (adhering to a given anchor point)
Rect screenViewPortHorizontal = new Rect();
Rect screenViewPortVertical = new Rect();
// Calculate both a horizontally and vertically resized viewport
screenViewPortHorizontal.width = originViewPort.width;
screenViewPortHorizontal.height = originViewPort.width * (localViewPort.height / localViewPort.width);
screenViewPortHorizontal.x = originViewPort.x;
screenViewPortHorizontal.y = Mathf.Lerp(originViewPort.y, originViewPort.y + (originViewPort.height - screenViewPortHorizontal.height), vectorAnchor.y);
screenViewPortVertical.width = originViewPort.height * (localViewPort.width / localViewPort.height);
screenViewPortVertical.height = originViewPort.height;
screenViewPortVertical.x = Mathf.Lerp(originViewPort.x, originViewPort.x + (originViewPort.width - screenViewPortVertical.width), vectorAnchor.x);
screenViewPortVertical.y = originViewPort.y;
// Use the best fitting of the two
if (screenViewPortHorizontal.height >= screenViewPortVertical.height && screenViewPortHorizontal.width >= screenViewPortVertical.width) {
if (screenViewPortHorizontal.height <= originViewPort.height && screenViewPortHorizontal.width <= originViewPort.width) {
camera.rect = screenViewPortHorizontal;
} else {
camera.rect = screenViewPortVertical;
}
} else {
if (screenViewPortVertical.height <= originViewPort.height && screenViewPortVertical.width <= originViewPort.width) {
camera.rect = screenViewPortVertical;
} else {
camera.rect = screenViewPortHorizontal;
}
}
}
}
// A class for tracking all cameras in a scene
[System.Serializable]
public class ForceCameraRatio : MonoBehaviour
{
public Vector2 ratio = new Vector2(16, 9);
public bool forceRatioOnAwake = true;
public bool listenForWindowChanges = true;
public bool createCameraForLetterBoxRendering = true;
public bool findCamerasAutomatically = true;
public Color letterBoxCameraColor = new Color(0, 0, 0, 1);
public List<CameraRatio> cameras;
public Camera letterBoxCamera;
private void Start () {
// If no cameras have been assigned in editor, search for cameras in the scene
if (findCamerasAutomatically) {
FindAllCamerasInScene();
} else if (cameras == null || cameras.Count == 0) {
cameras = new List<CameraRatio>();
}
ValidateCameraArray();
// Set the origin viewport space for each Camera
for (int i = 0; i < cameras.Count; i++) {
cameras[i].ResetOriginViewport();
}
// If requested, a Camera will be generated that renders a letter box Color
if (createCameraForLetterBoxRendering) {
letterBoxCamera = new GameObject().AddComponent<Camera>();
letterBoxCamera.backgroundColor = letterBoxCameraColor;
letterBoxCamera.cullingMask = 0;
letterBoxCamera.depth = -100;
letterBoxCamera.farClipPlane = 1;
letterBoxCamera.useOcclusionCulling = false;
letterBoxCamera.allowHDR = false;
letterBoxCamera.clearFlags = CameraClearFlags.Color;
letterBoxCamera.name = "Letter Box Camera";
for (int i = 0; i < cameras.Count; i++) {
if (cameras[i].camera.depth == -100) {
Debug.LogError(cameras[i].camera.name + " has a depth of -100 and may conflict with the Letter Box Camera in Forced Camera Ratio!");
}
}
}
if (forceRatioOnAwake) {
CalculateAndSetAllCameraRatios();
}
}
private void Update () {
if (listenForWindowChanges) {
// Recalculate the viewport size if the window size has changed
CalculateAndSetAllCameraRatios();
if (letterBoxCamera != null) {
letterBoxCamera.backgroundColor = letterBoxCameraColor;
}
}
}
/// <summary>
/// Returns the container class for a Camera and it's ratio by the _camera it contains
/// Returns null if the given _camera is not being tracked
/// </summary>
/// <param name="_camera"></param>
/// <returns></returns>
private CameraRatio GetCameraRatioByCamera (Camera _camera) {
if (cameras == null) {
return null;
}
for (int i = 0; i < cameras.Count; i++) {
if (cameras[i] != null && cameras[i].camera == _camera) {
return cameras[i];
}
}
return null;
}
/// <summary>
/// Removes any null elements from the CameraRatio Array
/// </summary>
private void ValidateCameraArray() {
for (int i = cameras.Count - 1; i >= 0; i--) {
if (cameras[i].camera == null) {
cameras.RemoveAt(i);
}
}
}
/// <summary>
/// Populates the tracked Camera Array with every Camera currently in the scene
/// </summary>
public void FindAllCamerasInScene () {
Camera[] allCameras = FindObjectsOfType<Camera>();
cameras = new List<CameraRatio>();
for (int i = 0; i < allCameras.Length; i++) {
if ((createCameraForLetterBoxRendering || allCameras[i] != letterBoxCamera)) { // Ignore the Custom LetterBox Camera
cameras.Add(new CameraRatio(allCameras[i], new Vector2(0.5f, 0.5f)));
}
}
}
/// <summary>
/// Loops through all cameras in scene (or that have been set in editor)
/// Forces each camera to render at a given ratio
/// Creates a letter box effect if the new viewport does not match the current Window ratio
/// </summary>
public void CalculateAndSetAllCameraRatios () {
float targetAspect = ratio.x / ratio.y;
float currentAspect = ((float)Screen.width) / ((float)Screen.height);
bool horizontalLetterbox = false;
float fullWidth = targetAspect / currentAspect;
float fullHeight = currentAspect / targetAspect;
if (currentAspect > targetAspect) {
horizontalLetterbox = false;
}
for (int i = 0; i < cameras.Count; i++) {
cameras[i].SetAnchorBasedOnEnum(cameras[i].anchor);
cameras[i].CalculateAndSetCameraRatio(fullWidth, fullHeight, horizontalLetterbox);
}
}
/// <summary>
/// Set the anchor for a given Camera
/// </summary>
/// <param name="_camera"></param>
/// <param name="_anchor"></param>
public void SetCameraAnchor (Camera _camera, Vector2 _anchor) {
CameraRatio camera = GetCameraRatioByCamera(_camera);
if (camera != null) {
camera.vectorAnchor = _anchor;
}
}
public CameraRatio[] GetCameras () {
if (cameras == null) {
cameras = new List<CameraRatio>();
}
return cameras.ToArray();
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e188ee899633d0b49870a5ae38b7359d
timeCreated: 1446557149
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,377 @@
using UnityEngine;
using System.Collections;
using System.Linq.Expressions;
using System.Reflection;
using System;
namespace AutoLetterbox {
/* Util.cs
*
* Utility Class with multiple use mathmatical functions
*
* Written by Tom Elliott and Milo Keeble */
public static class Util {
public static string GrootWhatAreYouDoing() {
return "I am Groot.";
}
/// <summary>
/// Returns a value as a positive number
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static float AsPositive(float value) {
return Mathf.Abs(value);
}
/// <summary>
/// Returns a value as a negative number
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static float AsNegative(float value) {
return -Mathf.Abs(value);
}
/// <summary>
/// Bezier Interpolation between multiple points
/// </summary>
public static float BezierCurve(float[] p, float t) {
if (p.Length > 2) {
float[] newPoints = new float[p.Length - 1];
for (int i = 0; i < newPoints.Length; i++) {
newPoints[i] = Lerp(p[i], p[i + 1], t);
}
return BezierCurve(newPoints, t);
} else if (p.Length == 2) {
return Lerp(p[0], p[1], t);
} else {
Debug.Log("WARNING: A class attempted to get a Bezier Curve with less than two points!");
return 0;
}
}
/// <summary>
/// Bezier Interpolation between multiple points
/// </summary>
public static Vector3 BezierCurve(Vector3[] p, float t) {
if (p.Length > 2) {
Vector3[] newPoints = new Vector3[p.Length - 1];
for (int i = 0; i < newPoints.Length; i++) {
newPoints[i] = Lerp(p[i], p[i + 1], t);
}
return BezierCurve(newPoints, t);
} else if (p.Length == 2) {
return Lerp(p[0], p[1], t);
} else {
//Debug.Log("WARNING: A class attempted to get a Bezier Curve with less than two points!");
return Vector3.zero;
}
}
/// <summary>
/// Takes an existing velocity and a point of collision relative to the center of the object traveling
/// Returns a new, reflected velocity
/// (Rough estimate, should be considered inacurrate until a truer calculation is implemented)
/// </summary>
/// <param name="originalVelocity"></param>
/// <param name="normalOfCollision"></param>
/// <returns></returns>
public static Vector3 CalculateReflectedVelocity(Vector3 originalVelocity, Vector3 normalOfCollision) {
Vector3 hitDirection = -normalOfCollision;
Vector3 newDirection = originalVelocity.normalized;
newDirection = new Vector3(newDirection.x - hitDirection.x, newDirection.y - hitDirection.y, 0);
if (newDirection.sqrMagnitude == 0f) {
newDirection = -originalVelocity.normalized;
}
return newDirection;
}
/// <summary>
/// Returns a value no greater than max and no less than min
/// </summary>
/// <param name="min"></param>
/// <param name="max"></param>
/// <param name="value"></param>
/// <returns></returns>
public static float Clamp(float min, float max, float value) {
value = (value < min) ? min : value;
value = (value > max) ? max : value;
return value;
}
/// <summary>
/// Returns a value no greater than max and no less than min
/// </summary>
/// <param name="min"></param>
/// <param name="max"></param>
/// <param name="value"></param>
/// <returns></returns>
public static int Clamp(int min, int max, int value) {
value = (value < min) ? min : value;
value = (value > max) ? max : value;
return value;
}
/// <summary>
/// Converts a unity color to a hex string
/// </summary>
/// <param name="color">Color to convert, can be Color as well as Color32</param>
/// <returns>A hex string of the passed in color</returns>
public static string ColorToHex(Color32 color) {
string hex = color.r.ToString("X2") + color.g.ToString("X2") + color.b.ToString("X2");
return hex;
}
/// <summary>
/// Converts an angle in Degrees to a Vector2
/// </summary>
/// <returns>The converted Vector2</returns>
/// <param name="_angle">Angle in Degrees</param>
public static Vector2 DegreesToVector(float _angle) {
return new Vector2((float)Math.Cos(_angle * Mathf.Deg2Rad), (float)Math.Sin(_angle * Mathf.Deg2Rad));
}
/// <summary>
/// Returns the float difference between a and b
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public static float Difference(float a, float b) {
return (a > b) ? a - b : b - a;
}
/// <summary>
/// Returns the integer difference between a and b
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public static int Difference(int a, int b) {
return (a > b) ? a - b : b - a;
}
/// <summary>
/// Returns a normalized direction vector pointing at target from origin
/// </summary>
public static Vector3 DirectionVector(Vector3 origin, Vector3 target) {
return (target - origin).normalized;
}
/// <summary>
/// Outputs a custom error message from sender
/// Use this to keep error messages consistent
/// </summary>
public static void Error(object sender, string error) {
if (sender != null) {
Debug.Log(sender.GetType().ToString() + ": " + error);
} else {
Debug.Log("NULL SENDER: " + error);
}
}
/// <summary>
/// Returns the code given name of the variable
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="expression"></param>
/// <returns></returns>
public static string GetMemberName<T>(Expression<Func<T>> expression) {
MemberExpression body = (MemberExpression)expression.Body;
return body.Member.Name;
}
/// <summary>
/// Converts a hex string to a unity color
/// </summary>
/// <param name="hex">The hex string to convert</param>
/// <returns>A Color of the passed in Hex String</returns>
public static Color HexToColor(string hex) {
byte r = byte.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
byte g = byte.Parse(hex.Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
byte b = byte.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber);
return new Color32(r, g, b, 255);
}
/// <summary>
/// Returns the flag number for an int
/// </summary>
/// <param name="_index"></param>
/// <returns></returns>
public static int IndexToFlags(int _index) {
switch (_index) {
case 0: return 1;
case 1: return 2;
case 2: return 4;
case 3: return 8;
case 4: return 16;
case 5: return 32;
case 6: return 64;
case 7: return 128;
case 8: return 256;
case 9: return 512;
default: return -1;
}
}
/// <summary>
/// Returns true if the given integer is odd
/// Returns false if the given integer is even
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static bool IsOdd(int value) {
return value % 2 != 0;
}
/// <summary>
/// Linear Interpolation between two points
/// </summary>
public static Vector3 Lerp(Vector3 p1, Vector3 p2, float t) {
return p1 + (p2 - p1) * t;
}
/// <summary>
/// Linear Interpolation between two points
/// </summary>
public static float Lerp(float p1, float p2, float t) {
return p1 + (p2 - p1) * t;
}
/// <summary>
/// Outputs an error message from sender stating that variableName is null
/// Use this to keep error messages consistent
/// </summary>
public static void NullError(object sender, string variableName, string extraNotes = "") {
if (sender == null) {
Debug.Log("NULL SENDER: " + variableName + " is null! " + extraNotes);
} else {
Debug.Log(sender.GetType().ToString() + ": " + variableName + " is null! " + extraNotes);
}
}
/// <summary>
/// Returns value as a percentage of max - min clamped between 0 and 1
/// </summary>
/// <param name="min"></param>
/// <param name="max"></param>
/// <param name="value"></param>
/// <returns></returns>
public static float Percent(float min, float max, float value) {
if (max - min == 0) {
//Debug.Log("WARNING: A class attempted to find a percentage of 0!");
return 0f;
}
return Clamp(0f, 1f, (value - min) / (max - min));
}
/// <summary>
/// Returns value as an unclamped percentage of max - min
/// </summary>
/// <param name="min"></param>
/// <param name="max"></param>
/// <param name="value"></param>
/// <returns></returns>
public static float PercentUnclampled(float min, float max, float value) {
if (max - min == 0) {
Debug.Log("WARNING: A class attempted to find an unclamped percentage of 0!");
return 0f;
}
return (value - min) / (max - min);
}
/// <summary>
/// Takes 2 rectangles and tests if they intersect
/// </summary>
/// <param name="extremeMinA"></param>
/// <param name="extremeMaxA"></param>
/// <param name="extremeMinB"></param>
/// <param name="extremeMaxB"></param>
/// <returns></returns>
public static bool RectContainsRect(Vector2 extremeMinA, Vector2 extremeMaxA, Vector2 extremeMinB, Vector2 extremeMaxB) {
if (extremeMinA.y > extremeMaxB.y || extremeMaxA.y < extremeMinB.y ||
extremeMinA.x > extremeMaxB.x || extremeMaxA.x < extremeMinB.x) {
return false;
} else {
return true;
}
}
/// <summary>
/// Returns a vector3 reflected on the X axis
/// </summary>
/// <param name="_vector"></param>
/// <returns></returns>
public static Vector3 ReflectOnXAxis(Vector3 _vector) {
_vector.x = -_vector.x;
return _vector;
}
/// <summary>
/// Returns a vector3 reflected on the X and Y axis
/// </summary>
/// <param name="_vector"></param>
/// <returns></returns>
public static Vector3 ReflectOnXandYAxis(Vector3 _vector) {
_vector.x = -_vector.x;
_vector.y = -_vector.y;
return _vector;
}
/// <summary>
/// Returns a vector3 reflected on the Y axis
/// </summary>
/// <param name="_vector"></param>
/// <returns></returns>
public static Vector3 ReflectOnYAxis(Vector3 _vector) {
_vector.y = -_vector.y;
return _vector;
}
/// <summary>
/// Converts a Vector2 to an angle in Degrees
/// </summary>
/// <returns>The angle in degrees.</returns>
/// <param name="_vector">A vector2 to convert</param>
public static float VectorToDegrees(Vector2 _vector) {
float deg = (float)Mathf.Atan2(_vector.y, _vector.x) * Mathf.Rad2Deg;
return (deg > 0) ? deg : deg + 360f;
}
/// <summary>
/// Returns 'up' as if the X and Y axis where ground plane (Rather than X and Z)
/// </summary>
/// <returns></returns>
public static Vector3 XYplaneUpDirection() {
return new Vector3(0, 0, -1);
}
/// <summary>
/// Returns true if the given point is on screen via the main Camera
/// </summary>
/// <returns></returns>
public static bool IsPointOnMainCamera(Vector3 _point) {
if (Camera.main == null) { return false; }
Vector3 screenPoint = Camera.main.WorldToScreenPoint(_point);
if (screenPoint.x < 0 || screenPoint.y > Screen.width || screenPoint.y < 0 || screenPoint.y > Screen.height) {
return false;
} else {
return true;
}
}
//HexToColor & ColorToHex Shamelessly taken from wiki.unity3d.com/index.php?title=HexConverter, Written by mvi?
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8a561f82163dc584094296e9eb0a53af
timeCreated: 1447429093
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0ad40b73e4c86154a844eba4652ed8b0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,93 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: GameIconMaterial
m_Shader: {fileID: 4800000, guid: 51dc29d0415eb4f469ddb6c47666ba6b, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BgTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _ColorMask: 15
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _UVSec: 0
- _UseUIAlphaClip: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0e153f2fcfb066b4b851ea9b7e8e0ee5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,122 @@
Shader "UI/GameIconShader"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_MaskTex ("Texture", 2D) = "white" {}
_BgTex ("Texture", 2D) = "white" {}
_Color ("Colour", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
ColorMask [_ColorMask]
Pass
{
Name "Default"
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#pragma multi_compile __ UNITY_UI_CLIP_RECT
#pragma multi_compile __ UNITY_UI_ALPHACLIP
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
float4 worldPosition : TEXCOORD1;
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
sampler2D _MaskTex;
sampler2D _BgTex;
fixed4 _Color;
fixed4 _TextureSampleAdd;
float4 _ClipRect;
float4 _MainTex_ST;
v2f vert(appdata_t v)
{
v2f OUT;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
OUT.worldPosition = v.vertex;
OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
OUT.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
OUT.color = v.color * _Color;
return OUT;
}
fixed4 frag(v2f IN) : SV_Target
{
half4 color = tex2D(_MainTex, IN.texcoord);
fixed mask = tex2D(_MaskTex, IN.texcoord).r;
fixed bga = tex2D(_BgTex, IN.texcoord).a;
color.a = min(bga + (1.0 - mask), 1.0);
#ifdef UNITY_UI_CLIP_RECT
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
#endif
#ifdef UNITY_UI_ALPHACLIP
clip (color.a - 0.001);
#endif
return color;
}
ENDCG
}
}
}

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 51dc29d0415eb4f469ddb6c47666ba6b
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: d621f4ad13df1ce4c8c2a10aaf92af85
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -65,7 +65,7 @@ TextureImporter:
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 64
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
@ -77,7 +77,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 64
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0

View file

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: c8b53054c6df143469efcb6a19b1a72f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 44927bbad382d634391fbe8c1e34ba65
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1104,6 +1104,57 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 58431083}
m_CullTransparentMesh: 1
--- !u!1 &89978021
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 89978023}
- component: {fileID: 89978022}
m_Layer: 0
m_Name: LetterboxFullscreen
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!114 &89978022
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 89978021}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e188ee899633d0b49870a5ae38b7359d, type: 3}
m_Name:
m_EditorClassIdentifier:
ratio: {x: 16, y: 9}
forceRatioOnAwake: 1
listenForWindowChanges: 1
createCameraForLetterBoxRendering: 0
findCamerasAutomatically: 1
letterBoxCameraColor: {r: 0, g: 0, b: 0, a: 1}
cameras: []
letterBoxCamera: {fileID: 1186982022}
--- !u!4 &89978023
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 89978021}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &93132552
GameObject:
m_ObjectHideFlags: 0
@ -9615,9 +9666,9 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 5, y: -5}
m_AnchoredPosition: {x: 26, y: -26.000122}
m_SizeDelta: {x: 42, y: 42}
m_Pivot: {x: 0, y: 1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &781200687
MonoBehaviour:
m_ObjectHideFlags: 0
@ -9630,7 +9681,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Material: {fileID: 2100000, guid: 0e153f2fcfb066b4b851ea9b7e8e0ee5, type: 2}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
@ -9638,7 +9689,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 1bbc3c5c0d46c9945a5e9958109c4a7a, type: 3}
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@ -9670,6 +9721,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
GameTitlePreview: {fileID: 0}
GridGameSelector: {fileID: 1154875947}
MaskTex: {fileID: 0}
BgTex: {fileID: 0}
--- !u!114 &781200690
MonoBehaviour:
m_ObjectHideFlags: 0
@ -13408,6 +13461,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
SelectedMinigame:
SelectedGameIcon: {fileID: 0}
GameEventSelector: {fileID: 1056099131}
EventRef: {fileID: 1149103344}
CurrentSelected: {fileID: 841081095}
@ -13591,6 +13645,80 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1182082593}
m_CullTransparentMesh: 1
--- !u!1 &1186982020
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1186982023}
- component: {fileID: 1186982022}
m_Layer: 0
m_Name: LetterboxBgCam
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!20 &1186982022
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1186982020}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 5
m_Depth: -100
m_CullingMask:
serializedVersion: 2
m_Bits: 0
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1186982023
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1186982020}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1196204502
GameObject:
m_ObjectHideFlags: 0
@ -15416,6 +15544,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
MainCanvas: {fileID: 1791483802}
EditorCamera: {fileID: 2047408675}
EditorLetterbox: {fileID: 1733325622}
GameLetterbox: {fileID: 89978021}
ScreenRenderTexture: {fileID: 8400000, guid: d3f3d6ca32122da4d9e3a8e7aa2ede16, type: 2}
Screen: {fileID: 558010761}
GridGameSelector: {fileID: 1154875943}
@ -18632,6 +18762,60 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1709317942}
m_CullTransparentMesh: 1
--- !u!1 &1733325622
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1733325624}
- component: {fileID: 1733325623}
m_Layer: 0
m_Name: LetterboxEditor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1733325623
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1733325622}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e188ee899633d0b49870a5ae38b7359d, type: 3}
m_Name:
m_EditorClassIdentifier:
ratio: {x: 16, y: 9}
forceRatioOnAwake: 1
listenForWindowChanges: 1
createCameraForLetterBoxRendering: 0
findCamerasAutomatically: 0
letterBoxCameraColor: {r: 0, g: 0, b: 0, a: 1}
cameras:
- camera: {fileID: 2047408675}
anchor: 0
vectorAnchor: {x: 0.5, y: 0.5}
letterBoxCamera: {fileID: 1186982022}
--- !u!4 &1733325624
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1733325622}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1747099761
GameObject:
m_ObjectHideFlags: 0

View file

@ -28,6 +28,9 @@ namespace HeavenStudio.Editor
[SerializeField] private Canvas MainCanvas;
[SerializeField] public Camera EditorCamera;
[SerializeField] public GameObject EditorLetterbox;
[SerializeField] public GameObject GameLetterbox;
[Header("Rect")]
[SerializeField] private RenderTexture ScreenRenderTexture;
[SerializeField] private RawImage Screen;
@ -86,6 +89,8 @@ namespace HeavenStudio.Editor
{
GameObject GameIcon_ = Instantiate(GridGameSelector.GetChild(0).gameObject, GridGameSelector);
GameIcon_.GetComponent<Image>().sprite = GameIcon(EventCaller.instance.minigames[i].name);
GameIcon_.GetComponent<GridGameSelectorGame>().MaskTex = GameIconMask(EventCaller.instance.minigames[i].name);
GameIcon_.GetComponent<GridGameSelectorGame>().UnClickIcon();
GameIcon_.gameObject.SetActive(true);
GameIcon_.name = EventCaller.instance.minigames[i].displayName;
}
@ -215,6 +220,11 @@ namespace HeavenStudio.Editor
return Resources.Load<Sprite>($"Sprites/Editor/GameIcons/{name}");
}
public static Texture GameIconMask(string name)
{
return Resources.Load<Texture>($"Sprites/Editor/GameIcons/{name}_mask");
}
#region Dialogs
public void SelectMusic()
@ -431,6 +441,9 @@ namespace HeavenStudio.Editor
{
if (fullscreen == false)
{
EditorLetterbox.SetActive(false);
GameLetterbox.SetActive(true);
MainCanvas.enabled = false;
EditorCamera.enabled = false;
GameCamera.instance.camera.targetTexture = null;
@ -440,12 +453,19 @@ namespace HeavenStudio.Editor
}
else
{
EditorLetterbox.SetActive(true);
GameLetterbox.SetActive(false);
MainCanvas.enabled = true;
EditorCamera.enabled = true;
GameCamera.instance.camera.targetTexture = ScreenRenderTexture;
GameManager.instance.CursorCam.enabled = true;
GameManager.instance.OverlayCamera.targetTexture = ScreenRenderTexture;
fullscreen = false;
GameCamera.instance.camera.rect = new Rect(0, 0, 1, 1);
GameManager.instance.CursorCam.rect = new Rect(0, 0, 1, 1);
GameManager.instance.OverlayCamera.rect = new Rect(0, 0, 1, 1);
}
}

View file

@ -16,6 +16,7 @@ namespace HeavenStudio.Editor
public string SelectedMinigame;
[Header("Components")]
public GameObject SelectedGameIcon;
public GameObject GameEventSelector;
public GameObject EventRef;
public GameObject CurrentSelected;
@ -96,6 +97,10 @@ namespace HeavenStudio.Editor
public void SelectGame(string gameName, int index)
{
if (SelectedGameIcon != null)
{
SelectedGameIcon.GetComponent<GridGameSelectorGame>().UnClickIcon();
}
mg = EventCaller.instance.minigames.Find(c => c.displayName == gameName);
SelectedMinigame = gameName;
gameOpen = true;
@ -103,7 +108,9 @@ namespace HeavenStudio.Editor
DestroyEvents();
AddEvents();
transform.GetChild(index).GetChild(0).gameObject.SetActive(true);
// transform.GetChild(index).GetChild(0).gameObject.SetActive(true);
SelectedGameIcon = transform.GetChild(index).gameObject;
SelectedGameIcon.GetComponent<GridGameSelectorGame>().ClickIcon();
currentEventIndex = 0;
UpdateIndex(0, false);

View file

@ -1,6 +1,9 @@
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.UI;
using DG.Tweening;
namespace HeavenStudio.Editor
{
public class GridGameSelectorGame : MonoBehaviour
@ -9,14 +12,44 @@ namespace HeavenStudio.Editor
public GridGameSelector GridGameSelector;
public Texture MaskTex;
public Texture BgTex;
private Material m_Material;
private void Start()
{
Tooltip.AddTooltip(this.gameObject, this.gameObject.name);
}
public void SetupTextures()
{
if (m_Material == null)
{
m_Material = Instantiate(GetComponent<Image>().material);
GetComponent<Image>().material = m_Material;
}
m_Material.SetTexture("_MaskTex", MaskTex);
m_Material.SetTexture("_BgTex", BgTex);
}
public void OnClick()
{
GridGameSelector.SelectGame(this.gameObject.name, this.transform.GetSiblingIndex());
}
//TODO: animate between shapes
public void ClickIcon()
{
transform.DOScale(new Vector3(1.15f, 1.15f, 1f), 0.1f);
BgTex = Resources.Load<Texture>($"Sprites/GeneralPurpose/Circle");
SetupTextures();
}
public void UnClickIcon()
{
transform.DOScale(new Vector3(1f, 1f, 1f), 0.1f);
BgTex = Resources.Load<Texture>($"Sprites/GeneralPurpose/Square");
SetupTextures();
}
}
}

View file

@ -88,7 +88,7 @@ PlayerSettings:
bakeCollisionMeshes: 0
forceSingleInstance: 0
useFlipModelSwapchain: 1
resizableWindow: 0
resizableWindow: 1
useMacAppStoreValidation: 0
macAppStoreCategory: public.app-category.games
gpuSkinning: 0
@ -129,11 +129,11 @@ PlayerSettings:
vulkanEnableLateAcquireNextImage: 0
vulkanEnableCommandBufferRecycling: 1
m_SupportedAspectRatios:
4:3: 1
5:4: 1
16:10: 1
4:3: 0
5:4: 0
16:10: 0
16:9: 1
Others: 1
Others: 0
bundleVersion: 1.0
preloadedAssets: []
metroInputSource: 0