Example #1
0
        public bool CreateMergedWorldWithPins(out string error)
        {
            try
            {
                error = string.Empty;
                foreach (var pp in _profiles)
                {
                    ZPackage zPackage = new ZPackage(pp.m_worldData[_worldId].m_mapData);
                    _mapData.m_mapVersion = zPackage.ReadInt();
                    int textureSize = zPackage.ReadInt();

                    if (_mapData.m_textureSize != textureSize)
                    {
                        return(false);
                    }

                    for (int i = 0; i < (_mapData.m_textureSize * _mapData.m_textureSize); i++)
                    {
                        _mapData.m_mergedWorld[i] = (byte)(_mapData.m_mergedWorld[i] | Convert.ToByte(zPackage.ReadBool()));
                    }

                    if (_mapData.m_mapVersion >= 2)
                    {
                        int pinCount = zPackage.ReadInt();
                        for (int j = 0; j < pinCount; j++)
                        {
                            string  name      = zPackage.ReadString();
                            Vector3 pos       = zPackage.ReadVector3();
                            PinType type      = (PinType)zPackage.ReadInt();
                            bool    isChecked = _mapData.m_mapVersion >= 3 && zPackage.ReadBool();

                            _mapData.AddPin(name, pos, type, isChecked);
                            _mapData.AddProfilePin(pp.GetPlayerId(), name, pos, type, isChecked);
                        }
                    }
                    if (_mapData.m_mapVersion >= 4)
                    {
                        _mapData.m_isReferencePositionPublic = zPackage.ReadBool();
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }