Browse Source

增加屏幕适配

liuqilin 7 years ago
parent
commit
6efeef4843

BIN
.vs/Garden5_2017/DesignTimeBuild/.dtbcache


BIN
.vs/Garden5_2017/v15/Server/sqlite3/storage.ide


BIN
.vs/Garden5_2017/v15/Server/sqlite3/storage.ide-shm


BIN
.vs/Garden5_2017/v15/Server/sqlite3/storage.ide-wal


+ 1 - 9
Assets/Resource/Logo.unity

@@ -136,7 +136,7 @@ Transform:
   m_GameObject: {fileID: 465425181}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
   m_LocalPosition: {x: 0.007000349, y: 0.3710185, z: 0}
-  m_LocalScale: {x: 14.582621, y: 10.044084, z: 1}
+  m_LocalScale: {x: 17.453445, y: 12.021423, z: 1.1968662}
   m_Children: []
   m_Father: {fileID: 1511433819}
   m_RootOrder: 0
@@ -362,7 +362,6 @@ GameObject:
   m_Component:
   - component: {fileID: 1218118082}
   - component: {fileID: 1218118081}
-  - component: {fileID: 1218118080}
   - component: {fileID: 1218118079}
   - component: {fileID: 1218118078}
   m_Layer: 0
@@ -386,13 +385,6 @@ Behaviour:
   m_PrefabInternal: {fileID: 0}
   m_GameObject: {fileID: 1218118077}
   m_Enabled: 1
---- !u!92 &1218118080
-Behaviour:
-  m_ObjectHideFlags: 0
-  m_PrefabParentObject: {fileID: 0}
-  m_PrefabInternal: {fileID: 0}
-  m_GameObject: {fileID: 1218118077}
-  m_Enabled: 1
 --- !u!20 &1218118081
 Camera:
   m_ObjectHideFlags: 0

File diff suppressed because it is too large
+ 167 - 148
Assets/Resource/Prefab/PrefabUI/Canvas.prefab


+ 1 - 1
Assets/Resource/Shader/DragonboneUGUIMat.mat

@@ -8,7 +8,7 @@ Material:
   m_PrefabInternal: {fileID: 0}
   m_Name: DragonboneUGUIMat
   m_Shader: {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
-  m_ShaderKeywords: _EMISSION
+  m_ShaderKeywords: UNITY_UI_CLIP_RECT _EMISSION
   m_LightmapFlags: 1
   m_EnableInstancingVariants: 0
   m_DoubleSidedGI: 0

+ 1 - 1
Assets/Resource/Shader/GrayMat.mat

@@ -8,7 +8,7 @@ Material:
   m_PrefabInternal: {fileID: 0}
   m_Name: GrayMat
   m_Shader: {fileID: 4800000, guid: ac390d8200b91bd419e2d7b9e580d07d, type: 3}
-  m_ShaderKeywords: _EMISSION
+  m_ShaderKeywords: UNITY_UI_CLIP_RECT _EMISSION
   m_LightmapFlags: 1
   m_EnableInstancingVariants: 0
   m_DoubleSidedGI: 0

+ 33 - 86
Assets/Resource/Shader/TimerMat.mat

@@ -8,123 +8,70 @@ Material:
   m_PrefabInternal: {fileID: 0}
   m_Name: TimerMat
   m_Shader: {fileID: 4800000, guid: 7d3cfed4392d21542869d4cbc6419063, type: 3}
-  m_ShaderKeywords: _EMISSION
+  m_ShaderKeywords: UNITY_UI_CLIP_RECT _EMISSION
   m_LightmapFlags: 1
+  m_EnableInstancingVariants: 0
+  m_DoubleSidedGI: 0
   m_CustomRenderQueue: -1
   stringTagMap: {}
+  disabledShaderPasses: []
   m_SavedProperties:
-    serializedVersion: 2
+    serializedVersion: 3
     m_TexEnvs:
-    - first:
-        name: _BumpMap
-      second:
+    - _BumpMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _DetailAlbedoMap
-      second:
+    - _DetailAlbedoMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _DetailMask
-      second:
+    - _DetailMask:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _DetailNormalMap
-      second:
+    - _DetailNormalMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _EmissionMap
-      second:
+    - _EmissionMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _MainTex
-      second:
+    - _MainTex:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _MetallicGlossMap
-      second:
+    - _MetallicGlossMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _OcclusionMap
-      second:
+    - _OcclusionMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _ParallaxMap
-      second:
+    - _ParallaxMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
     m_Floats:
-    - first:
-        name: _BumpScale
-      second: 1
-    - first:
-        name: _Cutoff
-      second: 0.5
-    - first:
-        name: _DetailNormalMapScale
-      second: 1
-    - first:
-        name: _DstBlend
-      second: 0
-    - first:
-        name: _GlossMapScale
-      second: 1
-    - first:
-        name: _Glossiness
-      second: 0.5
-    - first:
-        name: _GlossyReflections
-      second: 1
-    - first:
-        name: _Metallic
-      second: 0
-    - first:
-        name: _Mode
-      second: 0
-    - first:
-        name: _OcclusionStrength
-      second: 1
-    - first:
-        name: _Parallax
-      second: 0.02
-    - first:
-        name: _SmoothnessTextureChannel
-      second: 0
-    - first:
-        name: _SpecularHighlights
-      second: 1
-    - first:
-        name: _SrcBlend
-      second: 1
-    - first:
-        name: _UVSec
-      second: 0
-    - first:
-        name: _UseUIAlphaClip
-      second: 0
-    - first:
-        name: _ZWrite
-      second: 1
+    - _BumpScale: 1
+    - _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
+    - _UVSec: 0
+    - _UseUIAlphaClip: 0
+    - _ZWrite: 1
     m_Colors:
-    - first:
-        name: _Color
-      second: {r: 1, g: 1, b: 1, a: 1}
-    - first:
-        name: _EmissionColor
-      second: {r: 0, g: 0, b: 0, a: 1}
+    - _Color: {r: 1, g: 1, b: 1, a: 1}
+    - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

+ 39 - 104
Assets/Resource/Shader/UICUll.mat

@@ -8,141 +8,76 @@ Material:
   m_PrefabInternal: {fileID: 0}
   m_Name: UICUll
   m_Shader: {fileID: 4800000, guid: 4b677e02ea2a4d34caf276d8cffed289, type: 3}
-  m_ShaderKeywords: _EMISSION
+  m_ShaderKeywords: UNITY_UI_CLIP_RECT _EMISSION
   m_LightmapFlags: 1
+  m_EnableInstancingVariants: 0
+  m_DoubleSidedGI: 0
   m_CustomRenderQueue: -1
   stringTagMap: {}
+  disabledShaderPasses: []
   m_SavedProperties:
-    serializedVersion: 2
+    serializedVersion: 3
     m_TexEnvs:
-    - first:
-        name: _BumpMap
-      second:
+    - _BumpMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _DetailAlbedoMap
-      second:
+    - _DetailAlbedoMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _DetailMask
-      second:
+    - _DetailMask:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _DetailNormalMap
-      second:
+    - _DetailNormalMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _EmissionMap
-      second:
+    - _EmissionMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _MainTex
-      second:
+    - _MainTex:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _MetallicGlossMap
-      second:
+    - _MetallicGlossMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _OcclusionMap
-      second:
+    - _OcclusionMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _ParallaxMap
-      second:
+    - _ParallaxMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
     m_Floats:
-    - first:
-        name: _BumpScale
-      second: 1
-    - first:
-        name: _ColorMask
-      second: 15
-    - first:
-        name: _Cutoff
-      second: 0.5
-    - first:
-        name: _DetailNormalMapScale
-      second: 1
-    - first:
-        name: _DstBlend
-      second: 0
-    - first:
-        name: _GlossMapScale
-      second: 1
-    - first:
-        name: _Glossiness
-      second: 0.5
-    - first:
-        name: _GlossyReflections
-      second: 1
-    - first:
-        name: _Metallic
-      second: 0
-    - first:
-        name: _Mode
-      second: 0
-    - first:
-        name: _OcclusionStrength
-      second: 1
-    - first:
-        name: _Parallax
-      second: 0.02
-    - first:
-        name: _SmoothnessTextureChannel
-      second: 0
-    - first:
-        name: _SpecularHighlights
-      second: 1
-    - first:
-        name: _SrcBlend
-      second: 1
-    - first:
-        name: _Stencil
-      second: 0
-    - first:
-        name: _StencilComp
-      second: 8
-    - first:
-        name: _StencilOp
-      second: 0
-    - first:
-        name: _StencilReadMask
-      second: 255
-    - first:
-        name: _StencilWriteMask
-      second: 255
-    - first:
-        name: _UVSec
-      second: 0
-    - first:
-        name: _UseUIAlphaClip
-      second: 0
-    - first:
-        name: _ZWrite
-      second: 1
+    - _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:
-    - first:
-        name: _Color
-      second: {r: 1, g: 1, b: 1, a: 1}
-    - first:
-        name: _EmissionColor
-      second: {r: 0, g: 0, b: 0, a: 1}
+    - _Color: {r: 1, g: 1, b: 1, a: 1}
+    - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

+ 32 - 83
Assets/Resource/Shader/UIMaskMat.mat

@@ -8,120 +8,69 @@ Material:
   m_PrefabInternal: {fileID: 0}
   m_Name: UIMaskMat
   m_Shader: {fileID: 4800000, guid: 62507a9ea3ab77f4db3a493bdcbe5eff, type: 3}
-  m_ShaderKeywords: _EMISSION
+  m_ShaderKeywords: UNITY_UI_CLIP_RECT _EMISSION
   m_LightmapFlags: 1
+  m_EnableInstancingVariants: 0
+  m_DoubleSidedGI: 0
   m_CustomRenderQueue: -1
   stringTagMap: {}
+  disabledShaderPasses: []
   m_SavedProperties:
-    serializedVersion: 2
+    serializedVersion: 3
     m_TexEnvs:
-    - first:
-        name: _BumpMap
-      second:
+    - _BumpMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _DetailAlbedoMap
-      second:
+    - _DetailAlbedoMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _DetailMask
-      second:
+    - _DetailMask:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _DetailNormalMap
-      second:
+    - _DetailNormalMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _EmissionMap
-      second:
+    - _EmissionMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _MainTex
-      second:
+    - _MainTex:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _MetallicGlossMap
-      second:
+    - _MetallicGlossMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _OcclusionMap
-      second:
+    - _OcclusionMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
-    - first:
-        name: _ParallaxMap
-      second:
+    - _ParallaxMap:
         m_Texture: {fileID: 0}
         m_Scale: {x: 1, y: 1}
         m_Offset: {x: 0, y: 0}
     m_Floats:
-    - first:
-        name: _BumpScale
-      second: 1
-    - first:
-        name: _Cutoff
-      second: 0.5
-    - first:
-        name: _DetailNormalMapScale
-      second: 1
-    - first:
-        name: _DstBlend
-      second: 0
-    - first:
-        name: _GlossMapScale
-      second: 1
-    - first:
-        name: _Glossiness
-      second: 0.5
-    - first:
-        name: _GlossyReflections
-      second: 1
-    - first:
-        name: _Metallic
-      second: 0
-    - first:
-        name: _Mode
-      second: 0
-    - first:
-        name: _OcclusionStrength
-      second: 1
-    - first:
-        name: _Parallax
-      second: 0.02
-    - first:
-        name: _SmoothnessTextureChannel
-      second: 0
-    - first:
-        name: _SpecularHighlights
-      second: 1
-    - first:
-        name: _SrcBlend
-      second: 1
-    - first:
-        name: _UVSec
-      second: 0
-    - first:
-        name: _ZWrite
-      second: 1
+    - _BumpScale: 1
+    - _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
+    - _UVSec: 0
+    - _ZWrite: 1
     m_Colors:
-    - first:
-        name: _Color
-      second: {r: 1, g: 1, b: 1, a: 1}
-    - first:
-        name: _EmissionColor
-      second: {r: 0, g: 0, b: 0, a: 1}
+    - _Color: {r: 1, g: 1, b: 1, a: 1}
+    - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

+ 4 - 0
Assets/Script/Manage/UIManager.cs

@@ -57,6 +57,10 @@ public class UIManager : Regist
         Camera = ResourceManager.Get(ResourceLabel.MainCamera, Folder.UI, true, tra, false, ObjType.MainCamera);
         EventSystem = ResourceManager.Get(ResourceLabel.EventSystem, Folder.UI, false, tra, false, ObjType.EventSystem);
 
+        ScreenAdapt screenAdapt = Camera.AddComponent<ScreenAdapt>();
+        screenAdapt.cam = Camera.GetComponent<Camera>();
+        screenAdapt.scaler = Canvas.GetComponent<CanvasScaler>();
+
         ResourceManager.SetActive(CanvasLabel.C_Main, true);
         ResourceManager.SetActive(CanvasLabel.U_LoadingPanel, true);
 

+ 5 - 5
Assets/Script/Tool/Bundle.cs

@@ -827,12 +827,12 @@ public class Bundle : MonoBehaviour
                 //Debug.Log(localMD5);
                 //Debug.Log(HttpManager.Md5);
                 needUpdate = localMD5 != HttpManager.Md5;
-                Debug.LogWarning(string.Format("NeedUpdate : {0}", needUpdate));
+                //Debug.LogWarning(string.Format("NeedUpdate : {0}", needUpdate));
+            }
+            if (Application.isEditor || Application.isMobilePlatform)
+            {
+                needUpdate = false;
             }
-            //if (Application.isEditor || Application.isMobilePlatform)
-            //{
-            //    needUpdate = false;
-            //}
             AssetBundleUtility.OnDownloadOrUpdateFinish += FinishDownloadAndLoad;
             if (needUpdate)
             {

+ 60 - 0
Assets/Script/Tool/ScreenAdapt.cs

@@ -0,0 +1,60 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class ScreenAdapt : MonoBehaviour
+{
+    public Camera cam;
+    public CanvasScaler scaler;
+
+    public void Start()
+    {
+        if (Application.isEditor)
+        {
+            return;
+        }
+
+        AdaptScreen(Screen.width, Screen.height);
+
+        //AdaptScreen(1600, 1000);
+    }
+
+    public void AdaptScreen(float sceenWidth, float screenHeight)
+    {
+        float refeRatio = scaler.referenceResolution.y/scaler.referenceResolution.x;
+        float deviceRatio = screenHeight/sceenWidth;
+
+        if (refeRatio < deviceRatio)
+        {
+            Rect rect = new Rect();
+
+            rect.width = 1;
+            rect.x = 0;
+
+            rect.height = refeRatio/deviceRatio;
+            rect.y = (1 - rect.height)/2;
+
+            cam.rect = rect;
+
+            scaler.matchWidthOrHeight = 0;
+        }
+        else if (refeRatio > deviceRatio)
+        {
+            Rect rect = new Rect();
+
+            refeRatio = scaler.referenceResolution.x/scaler.referenceResolution.y;
+            deviceRatio = sceenWidth/screenHeight;
+
+            rect.width = refeRatio/deviceRatio;
+            rect.x = (1 - rect.width)/2;
+
+            rect.height = 1;
+            rect.y = 0;
+
+            cam.rect = rect;
+
+            scaler.matchWidthOrHeight = 1;
+        }
+    }
+}

+ 13 - 0
Assets/Script/Tool/ScreenAdapt.cs.meta

@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 9c0d22590ba786547a0fbab3f0c93fda
+timeCreated: 1530079337
+licenseType: Pro
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 1
ProjectSettings/ProjectSettings.asset

@@ -159,7 +159,7 @@ PlayerSettings:
     iOS: 20
   AndroidBundleVersionCode: 28
   AndroidMinSdkVersion: 16
-  AndroidTargetSdkVersion: 24
+  AndroidTargetSdkVersion: 0
   AndroidPreferredInstallLocation: 1
   aotOptions: 
   stripEngineCode: 0

Some files were not shown because too many files changed in this diff