Quellcode durchsuchen

增加机器人功能

liuqilin vor 7 Jahren
Ursprung
Commit
04835500e3

+ 2 - 3
Assets/Resource/Logo.unity

@@ -445,10 +445,9 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: f1828554d8ffa12449b221fe29b2c32c, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
-  DebugMode: 1
+  DebugMode: 0
   CatchException: 0
-  DebugModeGo: {fileID: 1264531325540048, guid: b22fd2d9abc702d43ac62a412537d4e9,
-    type: 2}
+  DebugModeGo: {fileID: 0}
 --- !u!4 &1833966245
 Transform:
   m_ObjectHideFlags: 0

+ 1 - 1
Assets/Resource/Prefab/Object/PlazaRoomChest.prefab

@@ -57,7 +57,7 @@ GameObject:
   - component: {fileID: 33563640867506102}
   m_Layer: 0
   m_Name: Chest
-  m_TagString: Untagged
+  m_TagString: PlazaChest
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0

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

@@ -1,12 +1,9 @@
 <data>
-  <item id="1" robot_create_frequency="10,30" amt_fml="p/2" digit_chest_rate="0.3" color_chest_rate="0.42" move_frequency="5,10" create_chest_rate="0.2" chest_value="20,40" lifetime="10,30" />
+  <item id="1" amt_fml="2" digit_chest_rate="0.3" color_chest_rate="0.42" move_frequency="3,6" create_chest_rate="0.2" chest_value="20,40" lifetime="10,30" />
   <comment>
     <id>
 id
 </id>
-    <robot_create_frequency>
-每过多久生成一个机器人
-</robot_create_frequency>
     <amt_fml>
 计算房间内最大机器人个数
 </amt_fml>

BIN
Assets/Resource/Xlsx/robot_config.xlsx


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

@@ -146,6 +146,9 @@ public class Initializer : MonoBehaviour
             progress = "31-1";
             gameObject.AddScript<ChestMge>();
 
+            progress = "31-2";
+            gameObject.AddScript<RobotManager>();
+
             progress = "32";
             StartCoroutine(IInitialize());
         }

+ 2 - 0
Assets/Script/SFS/Data/Label.cs

@@ -7,7 +7,9 @@ public class Label
 {
     public static string Error = "e";
     public static string Data = "d";
+    public static string Random = "r";
     public static string InfoID = "i";
+    public static string Nickname = "n";
     public static string DataArray = "da";
     public static string CommandID = "c";
 

+ 1 - 0
Assets/Script/SFS/Data/PlazaRoomRep.cs

@@ -22,4 +22,5 @@
     DeactivateDefaultChest=(19),
     MarkRobotError=(20),
     LeaveRoomSucceed=(21),
+    CreateRobot=(22),
 }

+ 2 - 2
Assets/Script/SFS/Manager/BaseConnector.cs

@@ -9,8 +9,8 @@ public abstract class BaseConnector
     public GardenSmartFox GardenSmartFox;
 
     public static int TcpPort = 9933;
-    //public static string Host = "121.199.20.79";
-    public static string Host = "127.0.0.1";
+    public static string Host = "121.199.20.79";
+    //public static string Host = "127.0.0.1";
     public static string Zone = "GardenTest";
 
     public Action<BaseEvent> onConnectSucceed;

+ 1 - 1
Assets/Script/SFS/Manager/BaseLoggor.cs

@@ -42,7 +42,7 @@ public abstract class BaseLoggor
 
     public void OnLoginError(BaseEvent baseEvent)
     {
-        DebugManager.PrintKeysAndValuesOfBaseEvent("OnLoginError", baseEvent);
+        //DebugManager.PrintKeysAndValuesOfBaseEvent("OnLoginError", baseEvent);
 
         //Debug.Log("Login has error");
 

+ 2 - 1
Assets/Script/SFS/Manager/ChestMge.cs

@@ -33,7 +33,8 @@ public class ChestData
     //private static float YMin;
     //private static float YMax;
     private static Vector3 DefaultPosition;
-    private static Vector3 ChestDepthOffset = new Vector3(0, 0, 0.98f);
+    //private static Vector3 ChestDepthOffset = new Vector3(0, 0, 0.98f);
+    private static Vector3 ChestDepthOffset = new Vector3(0, 0, 1.040916f);
 
     #endregion
 

+ 14 - 8
Assets/Script/SFS/Manager/RobotManager.cs

@@ -4,7 +4,7 @@ using System.Collections.Generic;
 using UnityEngine;
 using Random = UnityEngine.Random;
 
-public class RobotManager
+public class RobotManager : Regist
 {
     #region Config
 
@@ -12,12 +12,18 @@ public class RobotManager
 
     #endregion
 
-    public static void AddRobot(int sfsRoomID, int maxRobot, Vector3 position, PlayerDirection direction)
+    public static void AddRobot(int currentRobotAmt, long robotConfigID, bool randomPos, string nickname, List<string> dressdatas)
     {
         Robot.Initialize();
-        Robot robot = new Robot(position, direction);
-        robot.Connect(sfsRoomID, maxRobot);
-        Robots.Add(robot);
+        int sfsRoomID = SFSManager.GardenSmartFox.PlazaRoomManager.CurrentPlazaRoom.Id;
+        int maxPlayer = SFSManager.GardenSmartFox.PlazaRoomManager.CurrentRoomData.MaxPlayer;
+        int maxRobot = (int) Auxiliary.FmlParse(Robot.MaxRobotAmtFml, "p", maxPlayer.ToString());
+        if (currentRobotAmt < maxRobot)
+        {
+            Robot robot = new Robot(robotConfigID, randomPos, nickname, dressdatas);
+            robot.Connect(sfsRoomID);
+            Robots.Add(robot);
+        }
     }
 
 
@@ -27,14 +33,14 @@ public class RobotManager
         {
             Robots[i].Deactivate(delay);
 
-            if (delay)
+            if (!delay)
             {
-                Robots.RemoveAt(i--);
+                i--;
             }
         }
     }
 
-    public static void Update()
+    public void Update()
     {
         for (int i = 0; i < Robots.Count; i++)
         {

+ 1 - 1
Assets/Script/SFS/Manager/SFSManager.cs

@@ -116,7 +116,7 @@ public class SFSManager : Regist
             GardenSmartFox.Connector.Disconnect();
         }
 
-        RobotManager.DeactivateAllRobots(false);
+        //RobotManager.DeactivateAllRobots(false);
     }
 
 

+ 14 - 10
Assets/Script/SFS/Manager/SFSPlazaRoomManager.cs

@@ -115,8 +115,11 @@ public class SFSPlazaRoomManager
                 Player.Flip(PlayerDirection.Left);
             }
 
-            float duration = Mathf.Clamp(Vector3.Magnitude(destination - Player.transform.position) / 1.5f, 0.25f, 10f) / Speed;
-
+            float offsetX = Mathf.Abs(destination.x - Player.transform.position.x);
+            float offsetY = Mathf.Abs(destination.y - Player.transform.position.y);
+            float offset = Mathf.Sqrt(offsetX*offsetX + offsetY*offsetY);
+            float duration = Mathf.Clamp(offset/1.5f, 0.25f, 100f)/Speed;
+           
             MoveTween = Player.transform.CreateTweenVec3D(destination, duration, false, true, true, Curve.EaseOutQuad);
 
             MoveTween.StartForward();
@@ -259,7 +262,6 @@ public class SFSPlazaRoomManager
     private Vector3 PlayerDefaultPosition;
     public void EnterPlazaRoom()
     {
-        PlazaRoom.Initialize();
         GardenSmartFox.EventManager.PlazaRoomEvent.GetAllChestData(CurrentRoomData.ID);
         foreach (var kv in UserInstanceDictionary)
         {
@@ -284,12 +286,6 @@ public class SFSPlazaRoomManager
         GardenSmartFox.PlazaRoomManager.PlazaRoomCamera = ManaReso.Get<Camera>("MainCamera");
         GardenSmartFox.PlazaRoomManager.CameraOriginPosition = GardenSmartFox.PlazaRoomManager.PlazaRoomCamera.transform.position;
 
-        PlayerDefaultPosition = GetDefaultPosition();
-        SelfInstance = InstantiatePlayer(ManaNickName.NickName, PlayerDefaultPosition, PlayerDirection.Left, ManaData.GetDressDataIDs(ManaPlayer.Player));
-        UserInstanceDictionary.Add(SFSManager.GardenSmartFox.User.Id, SelfInstance);
-        SendInstantiateRequset(-1);
-        SelfInstance.Player.transform.SetLZ(SelfInstance.Player.transform.localPosition.z - 0.001f);
-
         GardenSmartFox.PlazaRoomManager.CameraLeftBorder = ManaReso.Get("PlazaRoomCameraLeftBorder").position.x;
         GardenSmartFox.PlazaRoomManager.CameraRightBorder = ManaReso.Get("PlazaRoomCameraRightBorder").position.x;
 
@@ -444,7 +440,7 @@ public class SFSPlazaRoomManager
 
     public void RobotThread()
     {
-        RobotManager.Update();
+        
     }
 
 
@@ -507,6 +503,13 @@ public class SFSPlazaRoomManager
         {
             GardenSmartFox.PlazaRoomManager.CurrentPlazaRoom = room;
 
+            PlazaRoom.Initialize();
+            PlayerDefaultPosition = GetDefaultPosition();
+            SelfInstance = InstantiatePlayer(ManaNickName.NickName, PlayerDefaultPosition, PlayerDirection.Left, ManaData.GetDressDataIDs(ManaPlayer.Player));
+            UserInstanceDictionary.Add(SFSManager.GardenSmartFox.User.Id, SelfInstance);
+            SendInstantiateRequset(-1);
+            SelfInstance.Player.transform.SetLZ(SelfInstance.Player.transform.localPosition.z - 0.001f);
+
             JoinRoomResult = JoinRoomResult.Succeed;
             TryEnterPlazaRoom();
 
@@ -707,6 +710,7 @@ public class SFSPlazaRoomManager
 
     private static float MinZOffset = 0.0001f;
     private static float MaxZOffset = 0.001f;
+    public static PlayerDirection DefaultDirection = PlayerDirection.Left;
     public static Vector3 GetDefaultPosition()
     {
         float zOffset = Random.Range(MinZOffset, MaxZOffset);

+ 116 - 77
Assets/Script/SFS/Object/Robot.cs

@@ -17,9 +17,9 @@ public class Robot
 {
     #region Config
 
-    private static Vector2 LeftDownBorder; //todo
-    private static Vector2 RightTop; //todo
-    private static Camera Camera; //todo
+    private static Vector2 LeftDownBorder;
+    private static Vector2 RightTop;
+    private static Camera Camera;
 
     private static bool Initialized;
     private static int MinChestValue;
@@ -31,13 +31,12 @@ public class Robot
     private static float DigitChestRate;
     private static float MinMoveTime;
     private static float MaxMoveTime;
-    private static float MinRobotCreateTime;
-    private static float MaxRobotCreateTime;
-    private static string MaxRobotAmtFml;
+    public static string MaxRobotAmtFml;
     private static string ConfigName = "robot_config";
     private static string RootNodeName = "data";
     private static string DataNodeName = "item";
 
+    private long RobotConfigID;
     private string Nickname;
     private Vector3 Position;
     private PlayerDirection Direction;
@@ -66,13 +65,10 @@ public class Robot
         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);
+        List<int> ints = Auxiliary.IntListParse(',', attributes[index++].Value, null);
         MinMoveTime = ints[0];
         MaxMoveTime = ints[1];
         CreateChestRate = float.Parse(attributes[index++].Value);
@@ -98,19 +94,47 @@ public class Robot
     }
 
 
-    public Robot(Vector3 position, PlayerDirection direction)
+    public Robot(long robotConfigID, bool randomPos, string nickname, List<string> dressdatas)
     {
-        Position = position;
-        Direction = direction;
+        //if (randomPos)
+        //{
+        //    Vector3? pos;
+        //    while ((pos = Raycast()) == null);
+        //    Position = pos.Value;
+        //    Direction = (PlayerDirection) Random.Range(0, 2);
+        //}
+        //else
+        //{
+        //    Position = SFSPlazaRoomManager.GetDefaultPosition();
+        //    Direction = SFSPlazaRoomManager.DefaultDirection;
+        //}
+        Position = SFSPlazaRoomManager.GetDefaultPosition();
+        Direction = SFSPlazaRoomManager.DefaultDirection;
+
+        try
+        {
+            RobotConfigID = robotConfigID;
+            Nickname = nickname;
+            DressdataNames = dressdatas;
+            DressdataIDs = ManaData.GetDressDataIDs(DressdataNames);
+        }
+        catch (Exception e)
+        {
+            foreach (var DressdataName in DressdataNames)
+            {
+                Debug.LogWarning(DressdataName);
+            }
+            Debug.LogWarning(e);
+        }
     }
 
-    public void Connect(int sfsRoomID, int maxRobot)
+    public void Connect(int sfsRoomID)
     {
-        Debug.LogWarning("Robot connect");
+        //Debug.LogWarning("Robot connect");
         SmartFox = new SmartFox();
         SmartFox.AddEventListener(SFSEvent.CONNECTION, OnConnectReturn);
         SmartFox.AddEventListener(SFSEvent.CONNECTION_LOST, (evt) => Deactivate(false));
-        SmartFox.AddEventListener(SFSEvent.LOGIN, evt => { Mark(evt, sfsRoomID, maxRobot); });
+        SmartFox.AddEventListener(SFSEvent.LOGIN, evt => { Mark(evt, sfsRoomID); });
         SmartFox.AddEventListener(SFSEvent.LOGIN_ERROR, (evt) => Deactivate(false));
         SmartFox.AddEventListener(SFSEvent.LOGOUT, (evt) => Deactivate(false));
         SmartFox.AddEventListener(SFSEvent.EXTENSION_RESPONSE, OnExtensionResponse);
@@ -126,19 +150,19 @@ public class Robot
 
     private void Login()
     {
-        Debug.LogWarning("Robot login");
+        //Debug.LogWarning("Robot login");
         string userName = Random.Range(0f, 1000f).ToString();
         SmartFox.Send(new LoginRequest(userName, ""));
     }
 
-    private void Mark(BaseEvent evt, int sfsRoomID, int maxRobot)
+    private void Mark(BaseEvent evt, int sfsRoomID)
     {
-        Debug.LogWarning("Robot mark");
+        //Debug.LogWarning("Robot mark");
         User = (User) evt.Params["user"];
         SFSObject arg = new SFSObject();
         arg.PutInt(Label.CommandID, PlazaRoomReq.MarkAsRobot.GetHashCode());
         arg.PutInt(Label.RoomID, sfsRoomID);
-        arg.PutInt(Label.Data, maxRobot);
+        arg.PutLong(Label.UserID, RobotConfigID);
         SendRequest(arg);
     }
 
@@ -148,6 +172,12 @@ public class Robot
         SmartFox.Send(new ExtensionRequest(HandlerID.PlazaRoom.GetHashString(), arg));
     }
 
+    private void SendChestAwardRequest(long chestID)
+    {
+        SFSObject arg = PlazaRoomEvent.WrapChestAwardArg(chestID);
+        SendRequest(arg);
+    }
+
     private void SendInstantiateRequest(int receiver)
     {
         SFSManager.GardenSmartFox.EventManager.PlazaRoomEvent.SendInstantiateRequset(User.Id, DressdataIDs.ToArray(), Position, Direction, Nickname, receiver);
@@ -158,12 +188,12 @@ public class Robot
     {
         if ((bool) evt.Params["success"])
         {
-            Debug.LogWarning("Robot connect succeed");
+            //Debug.LogWarning("Robot connect succeed");
             Login();
         }
         else
         {
-            Debug.LogWarning("Robot connect failed");
+            //Debug.LogWarning("Robot connect failed");
             Deactivate(false);
         }
     }
@@ -180,7 +210,7 @@ public class Robot
         {
             Deactivate(false);
         }
-        else if (cmd == PlazaRoomRep.OtherEnterRoom.GetHashString()) //todo
+        else if (cmd == PlazaRoomRep.OtherEnterRoom.GetHashString())
         {
             OnOtherEnterRoom(evt);
         }
@@ -211,34 +241,12 @@ public class Robot
     private bool Activated;
     private void Activate(BaseEvent evt)
     {
-        if (!SFSManager.GardenSmartFox.PlazaRoomManager.InPlazaRoom)
-        {
-            Deactivate(false);
-        }
-
-        Debug.LogWarning("Robot Activate");
+        //Debug.LogWarning("Robot Activate");
         Activated = true;
         MoveTime = Random.Range(MinMoveTime, MaxMoveTime);
         LifetimeTime = Random.Range(MinLifetime, MaxLifetime);
         CreateChestTime = Random.Range(0, LifetimeTime);
-
-        try
-        {
-            ISFSObject arg = evt.Params["params"] as ISFSObject;
-            Nickname = arg.GetUtfString(Label.Data);
-            DressdataNames = arg.GetUtfStringArray(Label.DataArray).ToList();
-            DressdataIDs = ManaData.GetDressDataIDs(DressdataNames);
-            SendInstantiateRequest(-1);
-        }
-        catch (Exception e)
-        {
-            foreach (var DressdataName in DressdataNames)
-            {
-                Debug.LogWarning(DressdataName);
-            }
-            Debug.LogWarning(e);
-            Deactivate(false);
-        }
+        SendInstantiateRequest(-1);
     }
 
     private bool Behaviour()
@@ -248,14 +256,19 @@ public class Robot
             return false;
         }
 
-        //if (LifetimeBehaviour())
-        //{
-        //    return true;
-        //}
+        if (!SFSManager.GardenSmartFox.PlazaRoomManager.InPlazaRoom)
+        {
+            return false;
+        }
+
+        if (LifetimeBehaviour())
+        {
+            return true;
+        }
 
-        //MoveBehaviour();
-        //CreateChestBehaviour();
-        //GetChestAwardBehaviour();
+        MoveBehaviour();
+        CreateChestBehaviour();
+        GetChestAwardBehaviour();
         return false;
     }
 
@@ -267,25 +280,38 @@ public class Robot
         if (MoveTimer >= MoveTime)
         {
             MoveTimer = 0;
-            Debug.LogWarning("Robot move");
-            Raycast();
+            //Debug.LogWarning("Robot move");
+            Vector3? pos = Raycast();
+            if (pos != null)
+            {
+                Position = pos.Value;
+                SFSManager.GardenSmartFox.EventManager.PlazaRoomEvent.SendSynchronizeDestination(User.Id, Position);
+            }
         }
     }
 
-    private void Raycast() //todo
+    private Vector3? Raycast()
     {
         Vector3 origin = new Vector3(Random.Range(LeftDownBorder.x, RightTop.x), Random.Range(LeftDownBorder.y, RightTop.y), Camera.transform.position.z);
         Ray ray = new Ray(origin, Vector3.forward);
         RaycastHit hitInfo;
         if (Physics.Raycast(ray, out hitInfo))
         {
-            Vector3 destination = PlazaRoom.HitPositionToDestination(hitInfo.point);
-            SFSManager.GardenSmartFox.EventManager.PlazaRoomEvent.SendSynchronizeDestination(User.Id, destination);
-            Position = destination;
+            if (hitInfo.collider.tag == Tags.PlazaChestTag)
+            {
+                //Debug.LogWarning("射线被箱子阻挡");
+                return null;
+            }
+            else
+            {
+                Vector3 destination = PlazaRoom.HitPositionToDestination(hitInfo.point);
+                return destination;
+            }
         }
         else
         {
-            Debug.LogWarning("射线检测失败");
+            //Debug.LogWarning("射线检测失败");
+            return null;
         }
     }
 
@@ -297,7 +323,7 @@ public class Robot
         LifetimeTimer += Time.deltaTime;
         if (LifetimeTimer >= LifetimeTime)
         {
-            Debug.LogWarning("Robot lifetime over");
+            //Debug.LogWarning("Robot lifetime over");
             return true;
         }
         else
@@ -309,7 +335,7 @@ public class Robot
     private bool CreateChestLock;
     private float CreateChestTime;
     private float CreateChestTimer;
-    private void CreateChestBehaviour() //todo
+    private void CreateChestBehaviour()
     {
         if (CreateChestLock)
         {
@@ -322,39 +348,39 @@ public class Robot
             CreateChestLock = true;
             if (Random.Range(0f, 1f) >= CreateChestRate)
             {
-                Debug.LogWarning("create chest ran out of luck");
+                //Debug.LogWarning("create chest ran out of luck");
                 return;
             }
 
-            Debug.LogWarning("Robot create a chest");
+            //Debug.LogWarning("Robot create a chest");
             RoomData roomData = SFSManager.GardenSmartFox.PlazaRoomManager.CurrentRoomData;
             int round = Random.Range(1, roomData.MaxPlayer + 1);
             int value = Random.Range(MinChestValue, MaxChestValue);
-            Vector3 position = ChestMge.PlayerPosToChestPos(Position);
+            Vector3 playerPos = SFSManager.GardenSmartFox.PlazaRoomManager.UserInstanceDictionary[User.Id].Player.transform.position;
+            Vector3 chestPos = ChestMge.PlayerPosToChestPos(playerPos);
             ChestType type = (ChestType) Random.Range(1, 4);
-            SFSManager.GardenSmartFox.EventManager.PlazaRoomEvent.CreateChest(round, value, type, roomData.ID, -1, position);
+            SFSManager.GardenSmartFox.EventManager.PlazaRoomEvent.CreateChest(round, value, type, roomData.ID, -2, chestPos);
         }
     }
 
     private float GetChestTime = 3;
     private float GetChestTimer;
-    private float MaxChestDistance = 8; //todo
+    private float MaxChestDistance = 8;
     private List<long> OperatedChestIDs = new List<long>();
-    private void GetChestAwardBehaviour() //todo
+    private void GetChestAwardBehaviour()
     {
         GetChestTimer += Time.deltaTime;
         if (GetChestTimer >= GetChestTime)
         {
             GetChestTimer = 0;
-            Debug.LogWarning("Robot try get some chests");
+            //Debug.LogWarning("Robot try get some chests");
             List<PlazaRoomChest> chests = DetectChest();
-            Debug.LogWarning($"{chests.Count} chest/chests is available");
+            //Debug.LogWarning($"{chests.Count} chest/chests is available");
             for (int i = 0; i < chests.Count; i++)
             {
                 TryGetChestAward(chests[i]);
             }
         }
-        //Debug.LogWarning("robot get a chest");
     }
 
     private List<PlazaRoomChest> DetectChest()
@@ -367,7 +393,7 @@ public class Robot
             {
                 if (OperatedChestIDs.Contains(ChestMge.PlazaRoomChests[i].ChestData.ID))
                 {
-                    Debug.LogWarning("this chest has been operated");
+                    //Debug.LogWarning("this chest has been operated");
                 }
                 else
                 {
@@ -376,7 +402,8 @@ public class Robot
             }
             else
             {
-                Debug.LogWarning("this chest is too far");
+                //Debug.LogWarning("this chest is too far");
+                //Debug.LogWarning(Mathf.Abs(ChestMge.PlazaRoomChests[i].transform.position.x - Position.x));
             }
         }
 
@@ -409,6 +436,17 @@ public class Robot
                 get = false;
             }
         }
+        else if (chest.ChestData.ChestType == ChestType.System)
+        {
+            if (chest.IsActive)
+            {
+                get = true;
+            }
+            else
+            {
+                get = false;
+            }
+        }
         else
         {
             get = true;
@@ -417,11 +455,12 @@ public class Robot
         OperatedChestIDs.Add(chest.ChestData.ID);
         if (get)
         {
-            SFSManager.GardenSmartFox.EventManager.PlazaRoomEvent.GetChestAward(chest.ChestData.ID);
+            SendChestAwardRequest(chest.ChestData.ID);
+            //Debug.LogWarning("get a chest");
         }
         else
         {
-            Debug.LogWarning("get chest ran out of luck");
+            //Debug.LogWarning("get chest ran out of luck");
         }
     }
 
@@ -430,7 +469,7 @@ public class Robot
     private static float MaxDelayTime = 10f;
     public void Deactivate(bool delay)
     {
-        Debug.LogWarning("Robot disconnect");
+        //Debug.LogWarning("Robot disconnect " + delay);
         Activated = false;
 
         if (delay)

+ 4 - 0
Assets/Script/SFS/SFSEvent/EventDispatcher.cs

@@ -107,6 +107,10 @@ public class EventDispatcher
         {
             SFSEventManager.PlazaRoomEvent.OnLeaveRoom(baseEvent);
         }
+        else if (cmd == PlazaRoomRep.CreateRobot.GetHashString())
+        {
+            SFSEventManager.PlazaRoomEvent.CreateRobot(baseEvent);
+        }
         else
         {
             throw new Exception();

+ 20 - 1
Assets/Script/SFS/SFSEvent/PlazaRoomEvent.cs

@@ -4,6 +4,7 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using LitJson;
+using Sfs2X;
 using Sfs2X.Core;
 using Sfs2X.Entities;
 using Sfs2X.Requests;
@@ -265,11 +266,17 @@ public class PlazaRoomEvent
     }
 
 
-    public void GetChestAward(long chestID)
+    public static SFSObject WrapChestAwardArg(long chestID)
     {
         SFSObject parameter = new SFSObject();
         parameter.PutInt(Label.CommandID, PlazaRoomReq.GetChestAward.GetHashCode());
         parameter.PutLong(gd_chest.ID, chestID);
+        return parameter;
+    }
+
+    public void GetChestAward(long chestID)
+    {
+        SFSObject parameter = WrapChestAwardArg(chestID);
         SFSEventManager.GardenSmartFox.AddRequest(parameter, RequestType.Immediate);
     }
 
@@ -325,6 +332,18 @@ public class PlazaRoomEvent
     }
 
 
+    public void CreateRobot(BaseEvent baseEvent)
+    {
+        SFSObject arg = baseEvent.Params["params"] as SFSObject;
+        int currentRobotAmt = arg.GetInt(Label.Data);
+        long robotConfigID = arg.GetLong(Label.UserID);
+        bool random = arg.GetBool(Label.Random);
+        string nickname = arg.GetUtfString(Label.Nickname);
+        List<string> dressdatas = arg.GetUtfStringArray(Label.DataArray).ToList();
+        RobotManager.AddRobot(currentRobotAmt, robotConfigID, random, nickname, dressdatas);
+    }
+
+
     public void CheckDefaultChestStatus(int databaseRoomID)
     {
         SFSObject parameter = new SFSObject();

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

@@ -143,8 +143,7 @@ public class Auxiliary : Regist
 
         if (Input.GetKeyDown(KeyCode.Space))
         {
-            Vector3 position = SFSPlazaRoomManager.GetDefaultPosition();
-            RobotManager.AddRobot(1, 19, position, PlayerDirection.Left);
+            //RobotManager.AddRobot(SFSManager.GardenSmartFox.PlazaRoomManager.CurrentPlazaRoom.Id, 19, position, PlayerDirection.Left);
             //Resources.UnloadAsset(ManaReso.Get("U_LoadingPanel"));
             //foreach (var VARIABLE in ChestMge.PlazaRoomChests)
             //{

+ 3 - 3
ProjectSettings/GraphicsSettings.asset

@@ -43,13 +43,13 @@ GraphicsSettings:
     type: 0}
   m_TierSettings_Tier1:
     renderingPath: 1
-    useCascadedShadowMaps: 1
+    useCascadedShadowMaps: 0
   m_TierSettings_Tier2:
     renderingPath: 1
-    useCascadedShadowMaps: 1
+    useCascadedShadowMaps: 0
   m_TierSettings_Tier3:
     renderingPath: 1
-    useCascadedShadowMaps: 1
+    useCascadedShadowMaps: 0
   m_DefaultRenderingPath: 1
   m_DefaultMobileRenderingPath: 1
   m_TierSettings: []

+ 1 - 0
ProjectSettings/TagManager.asset

@@ -21,6 +21,7 @@ TagManager:
   - GoldAmount1
   - LogText
   - FxTemporaire
+  - PlazaChest
   layers:
   - Default
   - TransparentFX

+ 4 - 6
第四期.txt

@@ -1,14 +1,12 @@
-在房间里退出其他人收不到回调?
+机器人最大个数有Bug
 
+进入房间黑屏后退出没有音效了
 
-收到ActivateError后便不再创建机器人
-
-
-房间名字可以包含"吗
+开启公告
 
 过一段时间数据库会关闭的问题
 
-开启公告
+优化
 
 
 //关闭ManaDebug 开启CatchException