Example #1
0
            public void Tick(Vector3 pos)
            {
                List <int> indexList = GetNeighborIndex(GetMapIndex(pos));

                foreach (int index in indexList)
                {
                    MaskTile tile = Get(index);
                    if (null == tile)
                    {
                        Vector2 tilePos = GetCenterPos(index);
                        byte    type    = GetType((int)tilePos.x, (int)tilePos.y);
                        if (Pathea.PeGameMgr.IsMulti)
                        {
//							PlayerNetwork.MainPlayer.SyncMapArea(index, type);
                        }
                        else
                        {
                            tile       = new MaskTile();
                            tile.index = index;
                            tile.type  = type;

                            Add(index, tile);
                        }
                    }
                }
            }
Example #2
0
    protected override void OnPEDestroy()
    {
        StopAllCoroutines();

        DragArticleAgent.Destory(Id);

        if (null != _flagPos)
        {
            PeMap.LabelMgr.Instance.Remove(_flagPos);
            _flagPos = null;
        }

        int index = PeMap.MaskTile.Mgr.Instance.GetMapIndex(transform.position);

        PeMap.MaskTile mt = PeMap.MaskTile.Mgr.Instance.Get(index);
        if (null != mt)
        {
            mt.forceGroup = -1;
            PeMap.MaskTile.Mgr.Instance.Add(index, mt);
        }

        if (null == Runner)
        {
            return;
        }

        Destroy(Runner.gameObject);
    }
Example #3
0
    IEnumerator RefreshFlag()
    {
        while (null == PlayerNetwork.mainPlayer)
        {
            yield return(null);
        }

        int index = PeMap.MaskTile.Mgr.Instance.GetMapIndex(transform.position);

        PeMap.MaskTile mt = PeMap.MaskTile.Mgr.Instance.Get(index);
        if (null != mt)
        {
            mt.forceGroup = TeamId;
        }
        else
        {
            Vector2 tilePos = PeMap.MaskTile.Mgr.Instance.GetCenterPos(index);
            byte    type    = PeMap.MaskTile.Mgr.Instance.GetType((int)tilePos.x, (int)tilePos.y);

            mt            = new PeMap.MaskTile();
            mt.index      = index;
            mt.forceGroup = TeamId;
            mt.type       = type;
        }

        PeMap.MaskTile.Mgr.Instance.Add(index, mt);
    }
Example #4
0
    void RPC_S2C_ExploredAreas(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int[] indexes = stream.Read <int[]> ();

        if (ForceSetting.Instance.Conflict(Id, mainPlayerId))
        {
            return;
        }

        foreach (int index in indexes)
        {
            Vector2 tilePos = PeMap.MaskTile.Mgr.Instance.GetCenterPos(index);
            byte    type    = PeMap.MaskTile.Mgr.Instance.GetType((int)tilePos.x, (int)tilePos.y);

            PeMap.MaskTile tile = PeMap.MaskTile.Mgr.Instance.Get(index);
            if (null == tile)
            {
                tile            = new PeMap.MaskTile();
                tile.index      = index;
                tile.forceGroup = -1;
                tile.type       = type;
                PeMap.MaskTile.Mgr.Instance.Add(index, tile);
            }
        }
    }
Example #5
0
        public static void SerializeTile(uLink.BitStream stream, object obj, params object[] codecOptions)
        {
            MaskTile v = (MaskTile)(obj);

            stream.Write <int>(v.index);
            stream.Write <int>(v.forceGroup);
            stream.Write <byte>(v.type);
        }
Example #6
0
        public static object DeserializeTile(uLink.BitStream stream, params object[] codecOptions)
        {
            MaskTile v = new MaskTile();

            v.index      = stream.Read <int>();
            v.forceGroup = stream.Read <int>();
            v.type       = stream.Read <byte>();
            return(v);
        }
Example #7
0
            public void Add(int index, MaskTile tile)
            {
                maskTiles[index] = tile;

                Args args = new Args();

                args.index = index;
                args.add   = true;
                eventor.Dispatch(args, this);
            }
Example #8
0
            protected override void SetData(byte[] data)
            {
                PETools.Serialize.Import(data, (r) =>
                {
                    int count = r.ReadInt32();
                    for (int i = 0; i < count; i++)
                    {
                        byte[] buff = PETools.Serialize.ReadBytes(r);
                        if (null != buff && buff.Length > 0)
                        {
                            MaskTile mt = new MaskTile();
                            mt.Deserialize(buff);

                            Add(mt.index, mt);
                        }
                    }
                });
            }
Example #9
0
    void RemoveFlag()
    {
        if (null != _flagPos)
        {
            PeMap.LabelMgr.Instance.Remove(_flagPos);
            _flagPos = null;
        }

        if (!Pathea.PeGameMgr.IsStory && !Pathea.PeGameMgr.IsCustom)
        {
            int            index = PeMap.MaskTile.Mgr.Instance.GetMapIndex(transform.position);
            PeMap.MaskTile mt    = PeMap.MaskTile.Mgr.Instance.Get(index);
            if (null != mt)
            {
                mt.forceGroup = -1;
                PeMap.MaskTile.Mgr.Instance.Add(index, mt);
            }
        }
    }
Example #10
0
    void AddFlag()
    {
        if (null == _flagPos)
        {
            _flagPos            = new PeMap.StaticPoint();
            _flagPos.ID         = Id;
            _flagPos.icon       = PeMap.MapIcon.FlagIcon;
            _flagPos.fastTravel = true;
            _flagPos.text       = "Flag_" + Id;
            _flagPos.position   = _pos;

            PeMap.LabelMgr.Instance.Add(_flagPos);
        }

        if (!Pathea.PeGameMgr.IsStory && !Pathea.PeGameMgr.IsCustom)
        {
            int            index = PeMap.MaskTile.Mgr.Instance.GetMapIndex(_pos);
            PeMap.MaskTile mt    = PeMap.MaskTile.Mgr.Instance.Get(index);
            if (null != mt)
            {
                mt.forceGroup = TeamId;
            }
            else
            {
                Vector2 tilePos = PeMap.MaskTile.Mgr.Instance.GetCenterPos(index);
                byte    type    = PeMap.MaskTile.Mgr.Instance.GetType((int)tilePos.x, (int)tilePos.y);

                mt            = new PeMap.MaskTile();
                mt.index      = index;
                mt.forceGroup = TeamId;
                mt.type       = type;
            }

            PeMap.MaskTile.Mgr.Instance.Add(index, mt);
        }
    }