Skip to content
Snippets Groups Projects
Commit a12b060c authored by Sofiane Lasri's avatar Sofiane Lasri
Browse files

Updated uiWindow

parent 53604950
No related branches found
No related tags found
No related merge requests found
Showing
with 48 additions and 351 deletions
fileFormatVersion: 2
guid: bd77933c38810b54c8fb86b692a912d7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: bf3059e0a15849041b8b0350268575d3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 6a578d5acc7d5aa4eb46a1b668d4b503
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 0315cdf6ed72ffb4eb2ddc579ebc1a32
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: b607f35fe7b16de4e8f09d8f7888d6c2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 457570c1d76224e418918bf9c83d1506
ModelImporter:
serializedVersion: 21202
internalIDToNameTable:
- first:
74: -203655887218126122
second: mixamo.com
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 1
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 0
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: b451057a011d35f439afd90feb619f73
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: f3dd6e803e318dd4a81ad0bccb84317a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: e5a1f33524bdcd845b1b0e36cddcd33a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 5badd5bd540e5de4883cd0c454129951
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System;
using System.IO;
using System.Reflection;
[CustomEditor(typeof(Readme))]
[InitializeOnLoad]
public class ReadmeEditor : Editor {
static string kShowedReadmeSessionStateName = "ReadmeEditor.showedReadme";
static float kSpace = 16f;
static ReadmeEditor()
{
EditorApplication.delayCall += SelectReadmeAutomatically;
}
static void SelectReadmeAutomatically()
{
if (!SessionState.GetBool(kShowedReadmeSessionStateName, false ))
{
var readme = SelectReadme();
SessionState.SetBool(kShowedReadmeSessionStateName, true);
if (readme && !readme.loadedLayout)
{
LoadLayout();
readme.loadedLayout = true;
}
}
}
static void LoadLayout()
{
var assembly = typeof(EditorApplication).Assembly;
var windowLayoutType = assembly.GetType("UnityEditor.WindowLayout", true);
var method = windowLayoutType.GetMethod("LoadWindowLayout", BindingFlags.Public | BindingFlags.Static);
method.Invoke(null, new object[]{Path.Combine(Application.dataPath, "TutorialInfo/Layout.wlt"), false});
}
[MenuItem("Tutorial/Show Tutorial Instructions")]
static Readme SelectReadme()
{
var ids = AssetDatabase.FindAssets("Readme t:Readme");
if (ids.Length == 1)
{
var readmeObject = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(ids[0]));
Selection.objects = new UnityEngine.Object[]{readmeObject};
return (Readme)readmeObject;
}
else
{
Debug.Log("Couldn't find a readme");
return null;
}
}
protected override void OnHeaderGUI()
{
var readme = (Readme)target;
Init();
var iconWidth = Mathf.Min(EditorGUIUtility.currentViewWidth/3f - 20f, 128f);
GUILayout.BeginHorizontal("In BigTitle");
{
GUILayout.Label(readme.icon, GUILayout.Width(iconWidth), GUILayout.Height(iconWidth));
GUILayout.Label(readme.title, TitleStyle);
}
GUILayout.EndHorizontal();
}
public override void OnInspectorGUI()
{
var readme = (Readme)target;
Init();
foreach (var section in readme.sections)
{
if (!string.IsNullOrEmpty(section.heading))
{
GUILayout.Label(section.heading, HeadingStyle);
}
if (!string.IsNullOrEmpty(section.text))
{
GUILayout.Label(section.text, BodyStyle);
}
if (!string.IsNullOrEmpty(section.linkText))
{
if (LinkLabel(new GUIContent(section.linkText)))
{
Application.OpenURL(section.url);
}
}
GUILayout.Space(kSpace);
}
}
bool m_Initialized;
GUIStyle LinkStyle { get { return m_LinkStyle; } }
[SerializeField] GUIStyle m_LinkStyle;
GUIStyle TitleStyle { get { return m_TitleStyle; } }
[SerializeField] GUIStyle m_TitleStyle;
GUIStyle HeadingStyle { get { return m_HeadingStyle; } }
[SerializeField] GUIStyle m_HeadingStyle;
GUIStyle BodyStyle { get { return m_BodyStyle; } }
[SerializeField] GUIStyle m_BodyStyle;
void Init()
{
if (m_Initialized)
return;
m_BodyStyle = new GUIStyle(EditorStyles.label);
m_BodyStyle.wordWrap = true;
m_BodyStyle.fontSize = 14;
m_TitleStyle = new GUIStyle(m_BodyStyle);
m_TitleStyle.fontSize = 26;
m_HeadingStyle = new GUIStyle(m_BodyStyle);
m_HeadingStyle.fontSize = 18 ;
m_LinkStyle = new GUIStyle(m_BodyStyle);
m_LinkStyle.wordWrap = false;
// Match selection color which works nicely for both light and dark skins
m_LinkStyle.normal.textColor = new Color (0x00/255f, 0x78/255f, 0xDA/255f, 1f);
m_LinkStyle.stretchWidth = false;
m_Initialized = true;
}
bool LinkLabel (GUIContent label, params GUILayoutOption[] options)
{
var position = GUILayoutUtility.GetRect(label, LinkStyle, options);
Handles.BeginGUI ();
Handles.color = LinkStyle.normal.textColor;
Handles.DrawLine (new Vector3(position.xMin, position.yMax), new Vector3(position.xMax, position.yMax));
Handles.color = Color.white;
Handles.EndGUI ();
EditorGUIUtility.AddCursorRect (position, MouseCursor.Link);
return GUI.Button (position, label, LinkStyle);
}
}
fileFormatVersion: 2
guid: 476cc7d7cd9874016adc216baab94a0a
timeCreated: 1484146680
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -114,3 +114,21 @@
margin: 0;
font-weight: 500;
}
.window .content .horizontalContainer{
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
margin: 0;
}
.window .content .presentationImage {
width: 30%;
height: 100%;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
border-radius: 5px;
}
\ No newline at end of file
......@@ -48,7 +48,15 @@
// On ajoute les éléments à la fenêtre
uiWindowGameList.addElement("title", "Skateboard", null);
uiWindowGameList.addElement("textBox", "Cette partie est un jeu de skateboard", null);
var uiWindowContainer = uiWindowGameList.addElement("horizontalContainer", null, null);
document.getElementById(uiWindowContainer).style.height = "100%";
uiWindowGameList.addElement("presentationImage", "images/presentations/skateboard.png", uiWindowContainer);
var textBox = uiWindowGameList.addElement("textBox", "Cette partie est un jeu de skateboard", uiWindowContainer);
document.getElementById(textBox).style.height = "100%";
document.getElementById(textBox).style.flexGrow = "1";
document.getElementById(textBox).style.marginLeft = "1%";
uiWindowGameList.show();
}
}
......
BrowserAssets/UI/images/presentations/skateboard.png

153 KiB

......@@ -212,6 +212,27 @@ UIWindow.prototype.addElement = function(type, content, parent) {
if(this.debug == true) console.log("Added pre-defined element of type listContainer with id " + listContainerItemDiv.id +" to UIWindow with id " + this.id);
return listContainerItemDiv.id;
}else if(type == "horizontalContainer"){
var horizontalContainerDiv = document.createElement("div");
horizontalContainerDiv.className = "horizontalContainer";
horizontalContainerDiv.id=generateUniqueId();
parent.appendChild(horizontalContainerDiv);
if(this.debug == true) console.log("Added pre-defined element of type horizontalContainer with id " + horizontalContainerDiv.id +" to UIWindow with id " + this.id);
return horizontalContainerDiv.id;
} else if(type == "presentationImage"){
var presentationImageDiv = document.createElement("div");
presentationImageDiv.className = "presentationImage";
presentationImageDiv.id=generateUniqueId();
presentationImageDiv.style = "background-image: url('" + content + "')";
parent.appendChild(presentationImageDiv);
if(this.debug == true) console.log("Added pre-defined element of type presentationImage with id " + presentationImageDiv.id +" to UIWindow with id " + this.id);
return presentationImageDiv.id;
}
}
// Cette fonction servira à ajouter des élément HTML aux attribus personalisés
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment