コード例 #1
0
ファイル: Map.cs プロジェクト: Cjaker/TibiaUnity3D
        public void ParseMapRightRow(Internal.CommunicationStream message)
        {
            UnityEngine.Vector3Int position = WorldMapStorage.Position;
            position.x++;

            //NewGameManager.inst.RenderGroundRow(NewGameManager.rowType.right);

            var allFields = WorldMapStorage.GetFields();

            /*
             * int x = allFields[0].ObjectsNetwork[0]._lastPatternX;
             * int y = allFields[0].ObjectsNetwork[0]._lastPatternY;
             * int z = allFields[0].ObjectsNetwork[0]._lastPatternZ;
             */



            for (int i = 0; i < 20; i++)
            {
                for (int j = 0; j < 20; j++)
                {
                    for (int o = 0; o < 20; o++)
                    {
                        try
                        {
                            WorldMap.Field _field    = WorldMapStorage.GetField(new Vector3Int(i, j, o));
                            int            countItem = _field.ObjectsNetwork.Where(c => c != null).Count();

                            if (countItem > 4)
                            {
                                Debug.Log(WorldMapStorage.Position);
                                Debug.Log(Player.Position);
                                Debug.Log("not null" + i + " " + j + " " + o);
                            }

                            break;
                        }
                        catch (Exception ex)
                        {
                            //Debug.Log("null");
                        }
                    }
                }
            }


            ///////////////


            /*
             * int last_index = 0;
             * int count = 0;
             * for(int i=0; i<allFields.Length; i++)
             * {
             *  for(int j=0; j<allFields[i].ObjectsNetwork.Length; j++)
             *  {
             *      if (allFields[i].ObjectsNetwork[j] != null)
             *      {
             *          last_index = j;
             *          count++;
             *      }
             *
             *  }
             *  if (count > 2)
             *  {
             *      int posX = allFields[i].ObjectsNetwork[last_index]._lastPatternX;
             *      int posY = allFields[i].ObjectsNetwork[last_index]._lastPatternY;
             *      int posZ = allFields[i].ObjectsNetwork[last_index]._lastPatternZ;
             *      Debug.Log(count +" "+posX+ " "+posY+" "+posZ);
             *  }
             *  //
             *  count = 0;
             * }
             *
             */



            //List<ObjItem> RightMapObj = new List<ObjItem>();

            /*
             * for(int i=0; i<5; i++)
             * {
             *  UnityEngine.Vector3Int pos = new Vector3Int(position.x, position.y, position.z);
             *  WorldMap.Field _field = (WorldMapStorage.GetField(pos));
             *  _field.ObjectsNetwork[0].las
             * }
             */



            ////////
            //  var fields = WorldMapStorage.GetFields();


            //   foreach(var field in fields)
            //  {
            ///   var cos = field.ObjectsNetwork;

            ///  foreach (var tmp1 in cos)
            // {
            //  if (tmp1 == null)
            //       Debug.Log("null");
            ///  else
            //    Debug.Log("not null");


            //UnityEngine.Vector3 pos = new UnityEngine.Vector3(tmp1._lastPatternX, tmp1._lastPatternY, tmp1._lastPatternZ);

            //ObjItem item = new ObjItem((int)tmp1.Id, pos);
            //NewGameManager.AddObjToList(item);


            //   }
            //  }

            /////


            WorldMapStorage.Position = position;
            MiniMapStorage.Position  = position;
            WorldMapStorage.ScrollMap(-1, 0);
            WorldMapStorage.InvalidateOnscreenMessages();
            ProtocolGameExtentions.ReadArea(message, Constants.MapSizeX - 1, 0, Constants.MapSizeX - 1, Constants.MapSizeY - 1);
            WorldMapStorage.CacheRefresh = true;
        }