Browse Source

增加机器人功能

LiuQilin 7 years ago
parent
commit
732065bb96

+ 1 - 1
Assets/Resource/XML/Config/robot_config.xml.meta

@@ -4,5 +4,5 @@ timeCreated: 1509432694
 licenseType: Pro
 TextScriptImporter:
   userData: 
-  assetBundleName: 
+  assetBundleName: config
   assetBundleVariant: 

+ 9 - 0
Assets/Script/Manage/ManaData.cs

@@ -1133,6 +1133,15 @@ public class ManaData : Regist
     }
 
 
+    public static XmlDocument GetXmlDocument(string ConfigName)
+    {
+        TextAsset textAsset = ManaReso.Load<TextAsset>(ConfigName, Folder.Config);
+        XmlDocument xmlDocument = new XmlDocument();
+        xmlDocument.LoadXml(textAsset.text);
+        return xmlDocument;
+    }
+
+
     public static XmlDocument MergeXML(int nativeVersion, XmlDocument nativeDoc, XmlDocument defaultDoc)
     {
         if (nativeVersion < 0)

+ 23 - 0
Assets/Script/SFS/Manager/RobotManager.cs

@@ -0,0 +1,23 @@
+using System.Collections;
+using System.Collections.Generic;
+
+using UnityEngine;
+
+public class RobotManager : MonoBehaviour
+{
+    #region Config
+    
+    
+
+    #endregion
+
+    public void Start()
+    {
+
+    }
+
+    public void Update()
+    {
+
+    }
+}

+ 12 - 0
Assets/Script/SFS/Manager/RobotManager.cs.meta

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

+ 9 - 0
Assets/Script/SFS/Object.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 11236dc5464cbaa478d9fba12f1697ce
+folderAsset: yes
+timeCreated: 1509499730
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 90 - 0
Assets/Script/SFS/Object/Robot.cs

@@ -0,0 +1,90 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.Xml;
+using Sfs2X;
+using UnityEngine;
+
+public class Robot
+{
+    #region Config
+
+    private static bool Initialized;
+    private static int MinChestValue;
+    private static int MaxChestValue;
+    private static float MinLifetime;
+    private static float MaxLifetime;
+    private static float CreateChestRate;
+    private static float ColorChestRate;
+    private static float DigitChestRate;
+    private static float MinMoveTime;
+    private static float MaxMoveTime;
+    private static float MinRobotCreateTime;
+    private static float MaxRobotCreateTime;
+    private static string MaxRobotAmtFml;
+    private static string ConfigName = "robot_config";
+    private static string RootNodeName = "data";
+    private static string DataNodeName = "item";
+
+
+    private float LifetimeTimer;
+    private float MoveTimer;
+
+    private SmartFox SmartFox;
+    
+    #endregion
+
+    public static void Initialize()
+    {
+        if (Initialized)
+        {
+            Initialized = true;
+            return;
+        }
+
+        XmlDocument document = ManaData.GetXmlDocument(ConfigName);
+        XmlNode dataNode = document.SelectSingleNode(RootNodeName).SelectSingleNode(DataNodeName);
+        XmlAttributeCollection attributes = dataNode.Attributes;
+
+        int index = 1;
+        List<int> ints = Auxiliary.IntListParse(',', attributes[index++].Value, null);
+        MinRobotCreateTime = ints[0];
+        MaxRobotCreateTime = ints[1];
+        MaxRobotAmtFml = attributes[index++].Value;
+        DigitChestRate = float.Parse(attributes[index++].Value);
+        ColorChestRate = float.Parse(attributes[index++].Value);
+        ints = Auxiliary.IntListParse(',', attributes[index++].Value, null);
+        MinMoveTime = ints[0];
+        MaxMoveTime = ints[1];
+        CreateChestRate = float.Parse(attributes[index++].Value);
+        ints = Auxiliary.IntListParse(',', attributes[index++].Value, null);
+        MinChestValue = ints[0];
+        MaxChestValue = ints[1];
+        ints = Auxiliary.IntListParse(',', attributes[index++].Value, null);
+        MinLifetime = ints[0];
+        MaxLifetime = ints[1];
+
+        Debug.Log($"RobotConfig {MinRobotCreateTime}");
+        Debug.Log($"RobotConfig {MaxRobotCreateTime}");
+        Debug.Log($"RobotConfig {MaxRobotAmtFml}");
+        Debug.Log($"RobotConfig {DigitChestRate}");
+        Debug.Log($"RobotConfig {ColorChestRate}");
+        Debug.Log($"RobotConfig {MinMoveTime}");
+        Debug.Log($"RobotConfig {MaxMoveTime}");
+        Debug.Log($"RobotConfig {CreateChestRate}");
+        Debug.Log($"RobotConfig {MinChestValue}");
+        Debug.Log($"RobotConfig {MaxChestValue}");
+        Debug.Log($"RobotConfig {MinLifetime}");
+        Debug.Log($"RobotConfig {MaxLifetime}");
+    }
+
+
+    public void Start()
+    {
+
+    }
+
+    public void Update()
+    {
+
+    }
+}

+ 12 - 0
Assets/Script/SFS/Object/Robot.cs.meta

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

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

@@ -142,7 +142,8 @@ public class Auxiliary : Regist
 
         if (Input.GetKeyDown(KeyCode.Space))
         {
-            Resources.UnloadAsset(ManaReso.Get("U_LoadingPanel"));
+            Robot.Initialize();
+            //Resources.UnloadAsset(ManaReso.Get("U_LoadingPanel"));
             //foreach (var VARIABLE in ChestMge.PlazaRoomChests)
             //{
             //    VARIABLE.ShadowSR.material = UnityFactory.Materials[0];

+ 3 - 0
第四期.txt

@@ -1,3 +1,6 @@
+开启公告
+
+
 关闭ManaDebug 开启CatchException
 
 切换到远程服务器