Browse Source

新增-小游戏说明

jet 8 years ago
parent
commit
2f9ac43352

BIN
Assets/Resource/Logo.unity


BIN
Assets/Resource/Prefab/PrefabUI/GroupB.prefab


+ 2 - 0
Assets/Resource/XML/lan/ChineseSimplified.xml

@@ -24,6 +24,8 @@
     <Fg_Lab1 desc=""><![CDATA[连接中]]></Fg_Lab1>
     <Fg_Lab2 desc=""><![CDATA[连接成功]]></Fg_Lab2>
     <Fg_Lab3 desc=""><![CDATA[连接失败 请检查你的网络设置]]></Fg_Lab3>
+    <D_DescA desc=""><![CDATA[小游戏A的描述小游戏A的描述小游戏A的描述小游戏A的描述小游戏A的描述小游戏A的描述]]></D_DescA>
+    <D_DescB desc=""><![CDATA[小游戏B的描述小游戏B的描述小游戏B的描述小游戏B的描述小游戏B的描述小游戏B的描述]]></D_DescB>
     <D_QuitLab desc=""><![CDATA[退出]]></D_QuitLab>
     <D_BeginLab0 desc=""><![CDATA[开始]]></D_BeginLab0>
     <D_BeginLab1 desc=""><![CDATA[准备]]></D_BeginLab1>

+ 2 - 0
Assets/Resource/XML/lan/ChineseTraditional.xml

@@ -24,6 +24,8 @@
     <Fg_Lab1 desc=""><![CDATA[連接中]]></Fg_Lab1>
     <Fg_Lab2 desc=""><![CDATA[連接成功]]></Fg_Lab2>
     <Fg_Lab3 desc=""><![CDATA[連接失敗 請檢查你的網路設置]]></Fg_Lab3>
+    <D_DescA desc=""><![CDATA[小游戏A的描述小游戏A的描述小游戏A的描述小游戏A的描述小游戏A的描述小游戏A的描述]]></D_DescA>
+    <D_DescB desc=""><![CDATA[小游戏B的描述小游戏B的描述小游戏B的描述小游戏B的描述小游戏B的描述小游戏B的描述]]></D_DescB>
     <D_QuitLab desc=""><![CDATA[退出]]></D_QuitLab>
     <D_BeginLab0 desc=""><![CDATA[開始]]></D_BeginLab0>
     <D_BeginLab1 desc=""><![CDATA[準備]]></D_BeginLab1>

+ 2 - 0
Assets/Resource/XML/lan/English.xml

@@ -24,6 +24,8 @@
     <Fg_Lab1 desc=""><![CDATA[Conneting]]></Fg_Lab1>
     <Fg_Lab2 desc=""><![CDATA[Connet successful]]></Fg_Lab2>
     <Fg_Lab3 desc=""><![CDATA[Connet fail, please check your network]]></Fg_Lab3>
+    <D_DescA desc=""><![CDATA[DescriptionADescriptionADescriptionADescriptionADescriptionADescriptionA]]></D_DescA>
+    <D_DescB desc=""><![CDATA[DescriptionBDescriptionBDescriptionBDescriptionBDescriptionBDescriptionB]]></D_DescB>
     <D_QuitLab desc=""><![CDATA[Quit]]></D_QuitLab>
     <D_BeginLab0 desc=""><![CDATA[Start]]></D_BeginLab0>
     <D_BeginLab1 desc=""><![CDATA[Ready]]></D_BeginLab1>

BIN
Assets/Resource/Xlsx/language_config.xlsx


+ 12 - 0
Assets/Script/Extension/ExtensionEqual.cs

@@ -17,6 +17,18 @@ public static class ExtensionEqua
         }
     }
 
+    public static bool Equal(this int i1, float f2, int accuracy = 0)
+    {
+        if (Math.Abs(i1 - f2) <= accuracy)
+        {
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
     public static bool Equal(this float f1, float f2, float accuracy = 0.0005f)
     {
         if (Math.Abs(f1 - f2) <= accuracy)

+ 5 - 1
Assets/Script/Manage/ManaMiniGame.cs

@@ -1260,6 +1260,7 @@ public class ManaMiniGame : Regist
         ManaReso.SetActive("D_Fertilize1", false);
 
         ManaReso.SetActive("D_Begin", true);
+        ManaReso.SetActive("D_DescA", true);
 
 
         if (Award.FlowerLock)
@@ -1334,7 +1335,7 @@ public class ManaMiniGame : Regist
         ManaReso.SetActive("D_FlowerBtn6", false);
 
         ManaReso.SetActive("D_Begin", true);
-
+        ManaReso.SetActive("D_DescB", true);
 
         List<int> idList = new List<int>() {1, 2, 4, 5, 7, 8};
 
@@ -1452,9 +1453,12 @@ public class ManaMiniGame : Regist
         PrepareTimer = 3;
 
         ManaReso.Get("D_Begin").SetActive(false);
+        ManaReso.Get("D_DescA").SetActive(false);
+        ManaReso.Get("D_DescB").SetActive(false);
 
         if (GameA)
         {
+
             ManaReso.Get("D_Rip1").SetActive(true);
             ManaReso.Get("D_Water1").SetActive(true);
             ManaReso.Get("D_Fertilize1").SetActive(true);

+ 3 - 0
Assets/Script/Manage/ManaUI.cs

@@ -448,6 +448,9 @@ public class ManaUI : Regist
         ManaReso.SetText("D_BeginLab", Language.GetStr("UI", "D_BeginLab0"));
         ManaReso.SetText("D_StatusLab", Language.GetStr("UI", "D_StatusLab0"));
 
+        ManaLan.Add(ManaReso.Get<Text>("D_DescA"), new LanStr("UI", "D_DescA"));
+        ManaLan.Add(ManaReso.Get<Text>("D_DescB"), new LanStr("UI", "D_DescB"));
+
         ManaLan.Add(ManaReso.Get<Text>("Da_Lab"), new LanStr("UI", "Da_Lab"));
         ManaLan.Add(ManaReso.Get<Text>("Da_QuitLab"), new LanStr("UI", "Da_QuitLab"));
         ManaLan.Add(ManaReso.Get<Text>("Da_ScoreTit"), new LanStr("UI", "Da_ScoreTit"));

+ 2 - 2
Assets/Script/Tool/Auxiliary.cs

@@ -130,12 +130,12 @@ public class Auxiliary : Regist
 
         if (Input.GetKeyDown(KeyCode.X))
         {
-            //ManaMiniGame.GameTimer = 45;
+           ManaMiniGame.GameTimer = 45;
         }
 
         if (Input.GetKeyDown(KeyCode.C))
         {
-            //ManaCenter.MiniTimer = 0;
+            ManaCenter.MiniTimer = 0;
         }
 
         if (Input.GetKeyDown(KeyCode.V))

+ 99 - 0
Assets/Script/Tool/UI/BestfitText.cs

@@ -0,0 +1,99 @@
+using System.Collections;
+using System.Collections.Generic;
+
+using UnityEngine;
+using UnityEngine.UI;
+using UnityEngine.Events;
+
+public class BestfitText : Text
+{
+    #region
+
+    protected string FormerText;
+    
+    #endregion
+
+    protected void Update()
+    {
+                
+    }
+
+    protected override void OnPopulateMesh(VertexHelper toFill)
+    {
+        base.OnPopulateMesh(toFill);
+
+        if (text != FormerText)
+        {
+            FormerText = text;
+
+            StartCoroutine(DelayCall(Bestfit, 2));
+        }
+    }
+
+    protected void Bestfit()
+    {
+        TextGenerationSettings textGenerationSettings = GetGenerationSettings(rectTransform.rect.size);
+
+        bool shrink = false;
+        bool expand = false;
+
+        int antiCrush = 0;
+        
+        while (true)
+        {
+            antiCrush++;
+
+            if (antiCrush > 100)
+            {
+                Debug.LogError("Crush");
+
+                break;
+            }
+
+            int preferredLineHeight = Mathf.CeilToInt(cachedTextGenerator.GetPreferredHeight("1", textGenerationSettings));
+
+            int preferredLineCount = Mathf.CeilToInt(cachedTextGenerator.GetPreferredHeight(text, textGenerationSettings)) / preferredLineHeight;
+
+            int bestHeight = preferredLineHeight * preferredLineCount;
+            
+            if (bestHeight > rectTransform.rect.size.y)
+            {
+                textGenerationSettings.fontSize--;
+
+                if (expand)
+                {
+                    break;
+                }
+
+                shrink = true;
+            }
+            else if (bestHeight < rectTransform.rect.size.y)
+            {
+                if (shrink)
+                {
+                    break;
+                }
+
+                textGenerationSettings.fontSize++;
+
+                expand = true;
+            }
+            else if (bestHeight.Equal(rectTransform.rect.size.y))
+            {
+                break;
+            }
+        }
+
+        fontSize = textGenerationSettings.fontSize;
+    }
+
+    protected IEnumerator DelayCall(UnityAction unityAction, int frame)
+    {
+        while (frame-- > 0)
+        {
+            yield return null;
+        }
+
+        unityAction.SafeInvoke();   
+    }
+}

+ 12 - 0
Assets/Script/Tool/UI/BestfitText.cs.meta

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

BIN
ProjectSettings/GraphicsSettings.asset


+ 1 - 1
ToList.txt

@@ -2,7 +2,7 @@
 
 //关闭调试界面
 
-//关闭调试按键
+关闭调试按键
 
 //关闭DebugMode