Inheritance: MonoBehaviour, IObserver
Beispiel #1
0
        void tileViewControl1_DrawItem(object sender, TileView.TileViewControl.DrawTileListItemEventArgs e)
        {
            Point pp = new Point(e.Bounds.X + tileViewControl1.TilePadding.Left, e.Bounds.Y + tileViewControl1.TilePadding.Top);

            e.Graphics.FillRectangle(Brushes.Pink, new Rectangle(pp, tileViewControl1.TileSize)); // tile itself

            //TODO: Rewrite text drawing completely
            string text = e.Index.ToString();
            /*
            SizeF ts = e.Graphics.MeasureString(text, tileViewControl1.Font);
            PointF tp = new PointF(pp.X + tileViewControl1.TileSize.Width / 2 - ts.Width / 2, pp.Y + tileViewControl1.TileSize.Height + ts.Height / 2);

            e.Graphics.DrawString(text, tileViewControl1.Font, new SolidBrush(tileViewControl1.ForeColor), tp.X, tp.Y); // text*/

            RectangleF rect = new RectangleF(e.Bounds.X, e.Bounds.Top + tileViewControl1.TilePadding.Top + tileViewControl1.TileSize.Height,tileViewControl1.TileSize.Width, tileViewControl1.TilePadding.Bottom);
            /*SizeF strLayout = new SizeF(tileViewControl1.TileSize.Width, tileViewControl1.TilePadding.Bottom);
            SizeF strSize = e.Graphics.MeasureString(text, e.Font, strLayout, tileViewControl1.TextStringFormat);
            PointF strPos = new PointF(e.Bounds.X + (e.Bounds.Width - strSize.Width) / 2, e.Bounds.Top + tileViewControl1.TilePadding.Top + tileViewControl1.TileSize.Height + ( strLayout.Height/2 - strSize.Height / 2));
            //new RectangleF(new PointF((ImagesListView.TileSize.Width - strSize.Width) / 2 + e.Bounds.Left, e.Bounds.Y + ImagesListView.TilePadding.Top + ImagesListView.TileSize.Height + (e.Font.Height - strSize.Height / 2))
            if (tileViewControl1.TilePadding.Bottom - strSize.Height < 2) return; //No space for text
            e.Graphics.DrawString(text, e.Font, SystemBrushes.ControlText, new RectangleF(strPos, strSize), tileViewControl1.TextStringFormat);*/
            e.DrawText(rect, text);
            //cannot use new SolidBrush(e.ForeColor) due to change on Focus to white
            //e.Graphics.DrawRectangle(Pens.Red, strPos.X, strPos.Y, strSize.Width, strSize.Height);
        }
Beispiel #2
0
    /// <summary>
    /// Initializes a new instance of the <see cref="Map"/> class.
    /// </summary>
    /// <param name='tileFactory'>
    /// Tile factory.
    /// </param>
    /// <param name='m'>
    /// M is the length of 1st dimension of the map.
    /// </param>
    /// <param name='n'>
    /// N is the length of 2nd dimemsion of the map.
    /// </param>
    public Map(List<ITile> tiles, ITileFactory tileFactory, ITileLoadingStrategy loadingStrategy, TileView prefab, int m, int n)
    {
        this.prefab = prefab;
        this.factory = tileFactory;
        this.loadingStrategy = loadingStrategy;
        this.size = new Vec2 (m, n);
        this.root = new GameObject ("Map");
        this.tileSet = new Dictionary<Vec2, TileView> (m * n);
        this.visibleTiles = new List<ITile> (m * n);

        LoadCachedTiles (tiles);
    }
    /// <summary>
    /// Changes the discovery grid. Where there is a ship we will sea water
    /// </summary>
    /// <param name="x">tile x coordinate</param>
    /// <param name="y">tile y coordinate</param>
    /// <returns>a tile, either what it actually is, or if it was a ship then return a sea tile</returns>
    public TileView this[int x, int y] {
        get {
            TileView result = _MyGrid[x, y];

            if (result == TileView.Ship)
            {
                return(TileView.Sea);
            }
            else
            {
                return(result);
            }
        }
    }
Beispiel #4
0
    public IEnumerator Walk()     // TODO: play appropriate animations
    {
        if (Path.Count < 2)
        {
            Debug.Log("WARN!!!! UnitView:StartMmoving Path null");
            yield return(new WaitForSeconds(0.0f));
        }

        int i = Path.Count - 1;

        IsMoving = true;
        Vector3 tilePos;

        while (i > 0)
        {
            TileView curTV    = Path[i];
            TileView nextTV   = Path[i - 1];
            int      numSteps = 10;
            Vector3  delta    = nextTV.GetPosition() - curTV.GetPosition();
            int      count    = 0;
            float    xDiff    = 0;
            float    yDiff    = 0;

            if (Mathf.Abs(delta.x) > 0)
            {
                xDiff = delta.x / numSteps;
            }
            else if (Mathf.Abs(delta.y) > 0)
            {
                yDiff = delta.y / numSteps;
            }
            else
            {
                Debug.Log("WARN!!! UnitView:StartMoving impossible state");
            }

            while (count++ < numSteps)
            {
                SetPosition(new Vector3(gameObject.transform.position.x + xDiff,
                                        gameObject.transform.position.y + yDiff,
                                        0));
                yield return(new WaitForSeconds(0.001f));
            }
            count = 0;
            i--;
        }

        IsMoving = false;
    }
Beispiel #5
0
 public void SwapTiles()
 {
     for (int t_childrenIndex = 0; t_childrenIndex < m_tilesParent.childCount; t_childrenIndex++)
     {
         TileView t_tile = m_tilesParent.GetChild(t_childrenIndex).GetComponent <TileView>();
         if (t_tile.TileType == Tiles.Circle)
         {
             t_tile.SetCross(t_tile.GetColor());
         }
         else if (t_tile.TileType == Tiles.Cross)
         {
             t_tile.SetCircle(t_tile.GetColor());
         }
     }
 }
Beispiel #6
0
    public void placeObj(TileView hoveredTile)
    {
        GameObject objToPut = getObjToPut();

        if (getCurrentEditMode() == EditModeEnum.wall)
        {
            int wallSize = objToPut.GetComponent <WallModel>().getSize();
            hoveredTile.occupyTileWithWall(objToPut, wallSize, getCurrentPlacingDirection());
        }

        if (getCurrentEditMode() == EditModeEnum.props)
        {
            hoveredTile.occupyTileWithProp(objToPut, getCurrentPlacingDirection());
        }
    }
Beispiel #7
0
    private static void SetTileProperties(GameObject p_tile, TileView _this)
    {
        // Set the appropriate texture.
        p_tile.renderer.material.SetTexture("_PathTex", m_textures [_this.m_tile.color]);
        p_tile.renderer.material.SetTexture("_PathMask", m_textures [_this.m_tile.color]);

        // Set the initial position if one does exist.
        if (_this.m_tile.position != null)
        {
            p_tile.transform.localPosition = new Vector3(_this.m_tile.position.x * m_offset_x * 1.5f, 0,
                                                         (_this.m_tile.position.y + 1) * m_offset_y);
            Vector3 eulerAngles = new Vector3(270, 90, 0);
            p_tile.transform.localRotation = Quaternion.Euler(eulerAngles);
        }
    }
Beispiel #8
0
 private void setPlacementValidity(TileView hoveredTile)
 {
     if (getCurrentEditMode() == EditModeEnum.wall)
     {
         int wallSize = objToPut.GetComponent <WallModel>().getSize();
         if (hoveredTile.isWallPlacementValid(wallSize, getCurrentPlacingDirection()))
         {
             setPlacingPreviewSucess();
         }
         else
         {
             setPlacingPreviewFail();
         }
     }
 }
 public void setAdjacentTiles()
 {
     for (int tileIndex = 0; tileIndex < tiles.Count; tileIndex++)
     {
         TileView        tile          = tiles[tileIndex].GetComponent <TileView>();
         List <TileView> tilesSurround = new List <TileView>()
         {
             getAdjacentTileOrNull(tileIndex, tileIndex - gridSize, gridSize, false),
             getAdjacentTileOrNull(tileIndex, tileIndex - 1, gridSize, true),
             getAdjacentTileOrNull(tileIndex, tileIndex + 1, gridSize, true),
             getAdjacentTileOrNull(tileIndex, tileIndex + gridSize, gridSize, false),
         };
         tile.setAdjacentsTiles(tilesSurround);
     }
 }
Beispiel #10
0
    public void HandleTileRemovedFromREM(EventTileRemovedFromREM p_event)
    {
        m_tiles.RemoveAt(p_event.index);
        for (int i = 0; i < p_event.index; i++)
        {
            Vector3 destination = new Vector3(m_delta_tile_world, 0, 0);
            SmoothTranslation.Translate(m_tiles[p_event.index - i - 1].gameObject, destination, i / 2.0f, TranslationType.DESTROY_ON_DESTINATION);
            m_tiles[i].index = i + 1;
        }

        Vector3 screenPoint = new Vector3((Screen.width - m_width_tiles) / 2, 70, m_cam.nearClipPlane + 5);
        Vector3 worldPos    = m_cam.ScreenToWorldPoint(screenPoint);

        m_tiles.Insert(0, TileView.InstantiateForRealEstateMarket(p_event.newTile, 0, worldPos, 1));
    }
Beispiel #11
0
 private void DestroyTilePair(Tile tile1, Tile tile2)
 {
     tileViews[tile1].OnTileViewClicked -= TileViewClickHandler;
     tileViews[tile2].OnTileViewClicked -= TileViewClickHandler;
     Destroy(tileViews[tile1].gameObject);
     Destroy(tileViews[tile2].gameObject);
     tileViews.Remove(tile1);
     tileViews.Remove(tile2);
     currentTileView = null;
     if (tileViews.Count == 0)
     {
         OnViewEmpty?.Invoke();
     }
     DrawView();
 }
Beispiel #12
0
    private void OnPlayerNewPosition(strange.extensions.dispatcher.eventdispatcher.api.IEvent data)
    {
        Vector2 playerPosition = (Vector2)data.data;

        if (tilesWorld.ContainsKey(playerPosition))
        {
            TileView tileView = tilesWorld[playerPosition][0].gameObject.GetComponent <TileView>();

            if (tileView != null)
            {
                dispatcher.Dispatch(RootEvents.E_PlayerUpdate, tileView);
                GiveTyle();
            }
        }
    }
Beispiel #13
0
    public static TileView Parse(string equal)
    {
        TileView view = new TileView();

        foreach (var key in keys)
        {
            if (equal.Contains(key))
            {
                view.key      = key;
                view.rotation = equal.IndexOf(key);
                return(view);
            }
        }
        return(view);
    }
Beispiel #14
0
 //TODO: Create wall model with wallSize
 public void occupyTileWithWall(GameObject wallToPut, int wallSize, UserController.Direction dir)
 {
     if (isWallPlacementValid(wallSize, dir))
     {
         var wallRotation = getObjRotation(transform, dir);
         wallOnTile = Instantiate(wallToPut, transform.position + wallToPut.transform.position, wallToPut.transform.rotation);
         wallOnTile.transform.parent = transform;
         wallOnTile.transform.RotateAround(transform.position, Vector3.up, wallRotation.eulerAngles.y);
         TileView nextTile = getNextTile(dir);
         for (int i = 1; i < wallSize; i++)
         {
             nextTile.setWallOnTile(wallOnTile);
             nextTile = nextTile.getNextTile(dir);
         }
     }
 }
Beispiel #15
0
        private void CreateMesh(GameObject prefab, Transform parent)
        {
            tileGameObject = Object.Instantiate(prefab);

            tileGameObject.transform.parent = parent;

            tileGameObject.name = Name;

            tileData = tileGameObject.GetComponent <TileData>();

            tileData.SetData(this);

            tileView = tileGameObject.GetComponent <TileView>();

            tileInput = tileGameObject.GetComponent <TileInput>();
        }
Beispiel #16
0
    public void SetWall(TileView t)
    {
        if (gameObject.transform.Find("Wall") == true)
        {
            t.wallFace = Random.Range(0, 4);
        }

        if (gameObject.transform.Find("Wall") && gameObject.transform.Find("Player"))
        {
            God.GSM.wallLimit = t.wallFace;
        }
        else
        {
            God.GSM.wallLimit = 5;
        }
    }
Beispiel #17
0
    public void UpdateTile(Field.Tile.TileTypes prevType, TileView tileView)
    {
        if (!_tiles.Contains(tileView))
        {
            throw new UnityException("Tile view not found!");
        }

        tileView.tile.left.tileView.ResetTile();
        tileView.tile.up.tileView.ResetTile();
        tileView.tile.right.tileView.ResetTile();
        tileView.tile.down.tileView.ResetTile();

        _tiles.Remove(tileView);
        _RenderTile(tileView.tile, tileView.transform.position);
        _ClearTile(prevType, tileView);
    }
        private uint PackTileInAtlas(uint layerIdx, uint tx, uint ty)
        {
            var tileIndex = tx + (ty * _mlmask.Layers[layerIdx].WidthInTiles0);

            if (_mlmask.Layers[layerIdx].Tiles[Convert.ToInt32(tileIndex)].AtlasInPosition == uint.MaxValue)
            {
                BlockCompressLocalTile(ref _mlmask.Layers[layerIdx], tileIndex);

                var recursiveHash = FNV1A.FnvHashInitial;
                for (uint y = 0; y < _mlmask.AtlasTileSize / 4; y++)
                {
                    for (uint x = 0; x < _mlmask.AtlasTileSize / 4; x++)
                    {
                        var compressedBlock = _mlmask.Layers[layerIdx].Tiles[Convert.ToInt32(tileIndex)].AtlasBlockCompressed[x + (y * _mlmask.AtlasTileSize / 4)];
                        var color32         = new float[16];
                        D3DX.D3DXDecodeBC4U(ref color32, compressedBlock);
                        var color8 = new byte[16];
                        for (uint i = 0; i < 16; ++i)
                        {
                            color8[i] = Convert.ToByte(color32[i] * 255.0f);
                        }

                        recursiveHash = FNV1A.HashReadOnlySpan(color8, recursiveHash);
                    }
                }

                var atlasView = new TileView();
                if (!_mlmask.AtlasTiles.TryGetValue(recursiveHash, out atlasView))
                {
                    var atlasTile = new TileView
                    {
                        AtlasInPosition = _mlmask.AtlasTilesCount++,
                        LayerIndex      = layerIdx,
                        LayerTileIndex  = tileIndex
                    };

                    atlasView = atlasTile;
                    _mlmask.AtlasTiles.Add(recursiveHash, atlasTile);
                }

                var z = _mlmask.Layers[layerIdx].Tiles[Convert.ToInt32(tileIndex)];
                z.AtlasInPosition = atlasView.AtlasInPosition;
                _mlmask.Layers[layerIdx].Tiles[Convert.ToInt32(tileIndex)] = z;
            }

            return(_mlmask.Layers[layerIdx].Tiles[Convert.ToInt32(tileIndex)].AtlasInPosition);
        }
Beispiel #19
0
    private void Start()
    {
        DataProvider = new ObservableList <ExampleListViewData>();
        var prefab = Resources.Load <GameObject>("Prefab/ExampleListItem_Tile");

        tileView = new TileView <ExampleListViewData>(tileListRectTransform, DataProvider, prefab);

        DataProvider.Clear(false);

        for (int i = 0, max = 107; i < max; i++)
        {
            var data = new ExampleListViewData(i, DataProvider);
            data.StringName.Value = "top : " + i;

            DataProvider.Add(data, i == max - 1);
        }
    }
Beispiel #20
0
    private void GiveTyle()
    {
        //Debug.LogError(tilesWorld.Count);

        foreach (var tile in tilesWorld)
        {
            TileView tileView = tile.Value[0].GetComponent <TileView>();

            if (tileView != null)
            {
                tileView.OnDeSpawn();
                dispatcher.Dispatch(RootEvents.E_TileSetToPool, tileView);
            }
        }

        tilesWorld.Clear();
    }
Beispiel #21
0
 private void TileViewClickHandler(TileView tileView)
 {
     if (currentTileView == null)
     {
         currentTileView = tileView;
         tileView.HighlightAsCurrent(true);
     }
     else if (tileView == currentTileView)
     {
         currentTileView = null;
         tileView.HighlightAsCurrent(false);
     }
     else
     {
         OnPairPicked?.Invoke(tiles[currentTileView], tiles[tileView]);
     }
 }
        private void ActionFilter(object sender, DevExpress.XtraGrid.Views.Base.RowFilterEventArgs e)
        {
            string   vendor = goodstypeTableAdapter1.GetDataByDesc(nowViewItem)[0].GDSTYPE_NO;
            TileView view   = sender as TileView;

            DataSet1.REP_GOODSRow row = view.GetDataRow(e.ListSourceRow) as DataSet1.REP_GOODSRow;
            if (row.GDSTYPE_NO == vendor)
            {
                e.Visible = true;
                e.Handled = false;
            }
            else
            {
                e.Visible = false;
                e.Handled = true;
            }
        }
Beispiel #23
0
    public void CheckIfPlayer(TileView t)
    {
        if (t.transform.Find("Player"))
        {
            t.playerDuration = playerTrail;
            t.GetComponentInChildren <Animator>().enabled = false;
        }
        else if (!t.transform.Find("Monster") || !t.transform.Find("RedKey") || !t.transform.Find("ScoreThing"))
        {
            t.GetComponentInChildren <Animator>().enabled = false;
        }

        if (t.playerDuration > 0 && !t.transform.Find("Player"))
        {
            t.GetComponentInChildren <SpriteRenderer>().sprite = God.SM.grey;
        }
    }
Beispiel #24
0
        void CleanTileLayers()
        {
            for (uint I = 0; I < mlmask.layers.Length; I++)
            {
                if (mlmask.layers[I]._width < mlmask._widthHigh)
                {
                    for (uint y = 0; y < mlmask._heightInTilesLow; y++)
                    {
                        for (uint x = 0; x < mlmask._widthInTilesLow; x++)
                        {
                            uint tx = (x * mlmask.layers[I]._width) / mlmask._widthLow;
                            uint ty = (y * mlmask.layers[I]._height) / mlmask._heightLow;

                            if (mlmask.layers[I].tiles[Convert.ToInt32(tx + ty * mlmask.layers[I]._widthInTiles0)]._rangeMax > 0)
                            {
                                TileView layer = new TileView();
                                layer._layerIndex      = I;
                                layer._layerTileIndex  = (tx + ty * mlmask.layers[I]._widthInTiles0);
                                layer._atlasInPosition = PackTileInAtlas(I, tx, ty);
                                mlmask._maskTilesLow[x + y * mlmask._widthInTilesLow]._layers.Add(layer);
                            }
                        }
                    }
                }
                else
                {
                    for (uint y = 0; y < mlmask._heightInTilesHigh; y++)
                    {
                        for (uint x = 0; x < mlmask._widthInTilesHigh; x++)
                        {
                            uint tx = (x * mlmask.layers[I]._width) / mlmask._widthHigh;
                            uint ty = (y * mlmask.layers[I]._height) / mlmask._heightHigh;

                            if (mlmask.layers[I].tiles[Convert.ToInt32(tx + ty * mlmask.layers[I]._widthInTiles0)]._rangeMax > 0)
                            {
                                TileView layer = new TileView();
                                layer._layerIndex      = I;
                                layer._layerTileIndex  = (tx + ty * mlmask.layers[I]._widthInTiles0);
                                layer._atlasInPosition = PackTileInAtlas(I, tx, ty);
                                mlmask._maskTilesHigh[x + y * mlmask._widthInTilesHigh]._layers.Add(layer);
                            }
                        }
                    }
                }
            }
        }
Beispiel #25
0
        private void SetupMap()
        {
            var map = new GameObject("Map");

            for (int x = 0; x < 5; x++)
            {
                for (int y = 0; y < 5; y++)
                {
                    var position = new Vector2Int(x, y);
                    var terrain  = terrainList[Random.Range(0, terrainList.Count)];
                    var tile     = new Tile(terrain, position);
                    tiles.Add(position, tile);
                    var tileView = TileView.createGameObject(map, tile);
                    tile.View = tileView;
                }
            }
        }
Beispiel #26
0
        uint PackTileInAtlas(uint layerIdx, uint tx, uint ty)
        {
            uint tileIndex = (tx + ty * mlmask.layers[layerIdx]._widthInTiles0);

            if (mlmask.layers[layerIdx].tiles[Convert.ToInt32(tileIndex)]._atlasInPosition == uint.MaxValue)
            {
                BlockCompressLocalTile(ref mlmask.layers[layerIdx], tileIndex);

                UInt64 recursiveHash = FNV1A.FnvHashInitial;
                for (uint y = 0; y < mlmask._atlasTileSize / 4; y++)
                {
                    for (uint x = 0; x < mlmask._atlasTileSize / 4; x++)
                    {
                        UInt64  compressedBlock = mlmask.layers[layerIdx].tiles[Convert.ToInt32(tileIndex)]._atlasBlockCompressed[x + y * mlmask._atlasTileSize / 4];
                        float[] color32         = new float[16];
                        D3DX.D3DXDecodeBC4U(ref color32, compressedBlock);
                        Byte[] color8 = new Byte[16];
                        for (uint i = 0; i < 16; ++i)
                        {
                            color8[i] = Convert.ToByte(color32[i] * 255.0f);
                        }

                        recursiveHash = FNV1A.HashReadOnlySpan(color8, recursiveHash);
                    }
                }

                TileView atlasView = new TileView();
                if (!mlmask._atlasTiles.TryGetValue(recursiveHash, out atlasView))
                {
                    TileView atlasTile = new TileView();
                    atlasTile._atlasInPosition = mlmask._atlasTilesCount++;
                    atlasTile._layerIndex      = layerIdx;
                    atlasTile._layerTileIndex  = tileIndex;

                    atlasView = atlasTile;
                    mlmask._atlasTiles.Add(recursiveHash, atlasTile);
                }

                var z = mlmask.layers[layerIdx].tiles[Convert.ToInt32(tileIndex)];
                z._atlasInPosition = atlasView._atlasInPosition;
                mlmask.layers[layerIdx].tiles[Convert.ToInt32(tileIndex)] = z;
            }

            return(mlmask.layers[layerIdx].tiles[Convert.ToInt32(tileIndex)]._atlasInPosition);
        }
Beispiel #27
0
 // find the coords of cell containing a point
 internal int?FindCellIndex(Vector2 point)
 {
     if (_lasttileview != null && _lasttileview.Rect.Contains(point))
     {
         return(_lasttileview.CellIndex.x);
     }
     foreach (var tile in _tiles)
     {
         var tileview = tile.GetComponent <TileView>();
         if (tileview.Rect.Contains(point))
         {
             _lasttileview = tileview;
             return(tileview.CellIndex.x);
         }
     }
     _lasttileview = null;
     return(null);
 }
Beispiel #28
0
        public void Clear()
        {
            for (int i = 0; i < _currentHandViews.Count; i++)
            {
                _currentHandViews[i].Clear();
                _handViewPoolManager.Recycle(_currentHandViews[i]);
            }

            _hands.Clear();
            _currentHandViews.Clear();
            _handGridLayoutGroup.Clear();

            if (_indicatorTileView != null)
            {
                _tileViewPoolManager.Recycle(_indicatorTileView);
            }
            _indicatorTileView = null;
        }
Beispiel #29
0
    public void MakeMove(Move t_move, Tiles p_tileType, Color p_color)
    {
        TileView t_tile = m_tilesParent.GetChild(t_move.Row * 3 + t_move.Column).GetComponent <TileView>();

        if (p_tileType == Tiles.Cross)
        {
            t_tile.SetCross(p_color);
        }
        else
        {
            t_tile.SetCircle(p_color);
        }
        Vector3 t_particlesPosition = m_placingTileParticles.transform.position;

        t_particlesPosition.x = t_tile.transform.position.x;
        t_particlesPosition.y = t_tile.transform.position.y;
        m_placingTileParticles.transform.position = t_particlesPosition;
        m_placingTileParticles.Play();
    }
        private void tileView1_ItemDoubleClick(object sender, TileViewItemClickEventArgs e)
        {
            //  tileview에 있는 데이터를 가져온다.
            TileView view = e.Item.View;
            Pet      pet  = view.GetFocusedRow() as Pet;

            // as :  캐스팅 하는건데 대신에 얘가 값이 안맞으면 null을 반환해줘 맞으면 캐스팅 해줘 대신에 값타입은 안돼용
            if (pet == null)
            {
                return;
            }



            // 클릭히먄 옆에 디테일에 데이터 이동
            pictureEdit1.Image = ByteArrayToImage(pet.Picture);
            txeName.Text       = pet.Name;
            txeSpecies.Text    = pet.Species;
            txeAge.Text        = pet.Age.ToString();
            cbbeGender.Text    = pet.Gender;
            txbSize.Text       = pet.Size;
            txbWeight.Text     = pet.Weight.ToString();
            txbEtc.Text        = pet.ETC;

            if (pet.HasNeutralized == true)
            {
                cbHasNeutralized.CheckState = CheckState.Checked;
            }
            else
            {
                cbHasNeutralized.CheckState = CheckState.Unchecked;
            }


            if (pet.HasVaccinated == true)
            {
                cbHasVaccinated.CheckState = CheckState.Checked;
            }
            else
            {
                cbHasVaccinated.CheckState = CheckState.Unchecked;
            }
        }
Beispiel #31
0
    private void ReceiveTile(strange.extensions.dispatcher.eventdispatcher.api.IEvent data)
    {
        TileView tile = data.data as TileView;

        if (tile != null)
        {
            if (tilePool.ContainsKey(tile.TileType))
            {
                tilePool[tile.TileType].Add(tile.gameObject);
                tile.gameObject.transform.parent        = gameObject.transform;
                tile.gameObject.transform.localPosition = Vector2.zero;
            }

            else
            {
                Debug.LogError(string.Format("tilePool not Contains {0} key", tile.TileType.ToString()));
            }
        }
    }
    public TextureInfoViewer()
    {
        _textureInfoTable = new TableView(this, typeof(TextureInfoItem));
        _textureInfoTable.AddColumn("TextureName", "Texture Name", 0.5f, TextAnchor.MiddleLeft);
        _textureInfoTable.AddColumn("TextureWidth", "Width", 0.1f, TextAnchor.MiddleCenter);
        _textureInfoTable.AddColumn("TextureHeight", "Height", 0.1f, TextAnchor.MiddleCenter);
        _textureInfoTable.AddColumn("TextureSize", "Size", 0.2f, TextAnchor.MiddleCenter, PAEditorConst.BytesFormatter);
        _textureInfoTable.OnSelected += OnTextureSelected;

        _textureInfoTiles             = new TileView(this);
        _textureInfoTiles.OnSelected += OnTextureSelected;

        _textureCatTable = new TableView(this, typeof(TextureCategoryItem));
        _textureCatTable.AddColumn("TextureCatName", "Category Name", 0.5f, TextAnchor.MiddleLeft);
        _textureCatTable.AddColumn("TextureCat", "CatID", 0.1f);
        _textureCatTable.AddColumn("TextureCatSize", "Size", 0.2f, TextAnchor.MiddleCenter, PAEditorConst.BytesFormatter);
        _textureCatTable.AddColumn("TextureCatCount", "Count", 0.2f);
        _textureCatTable.OnSelected += TableView_TextureCategorySelected;
    }
Beispiel #33
0
		private void UpdateTileViews()
        {
			DestroyTileViews();

			if (ServerEntity.Tiles == null || ServerEntity.Tiles.Count == 0)
				return;

			_tileViews = new List<TileView>();
			
			// No Need for dispatcher here, this is called from a routine that is already in a dispatcher
            foreach (Tile tile in ServerEntity.Tiles)
            {
				var tileView = new TileView(tile, _eventMediator);
				TileContainer.Children.Add(tileView);
                _tileViews.Add(tileView);
            }

			UpdateBorder();
			CreateScrollbar();
        }
Beispiel #34
0
 public void TakeView(TileView tv)
 {
     switch (tv)
        {
                  case TileView.Hit:
                  Shot = true;
                  HasShip = true;
                  break;
                  case TileView.Miss:
                  Shot = true;
                  HasShip = false;
                  break;
                  case TileView.Sea:
                  Shot = false;
                  break;
                  case TileView.Ship:
                  HasShip = true;
                  break;
        }
 }
Beispiel #35
0
 public TileViewMessage(int x, int y, TileView view)
 {
     X = x;
        Y = y;
        View = view;
 }
Beispiel #36
0
 public void Decode(NetIncomingMessage im)
 {
     this.X = im.ReadInt32();
        this.Y = im.ReadInt32();
        this.View = (TileView) im.ReadInt32();
 }
Beispiel #37
0
 public void TvAssign(int row, int col, TileView tileView)
 {
     _myGrid.TvAssign(row, col, tileView);
 }
Beispiel #38
0
 public void TvAssign(int row, int col, TileView tileView)
 {
     _gameTiles[row,col].TakeView(tileView);
 }
Beispiel #39
0
    private static void SetTileProperties(GameObject p_tile, TileView _this)
    {
        // Set the appropriate texture.
        p_tile.renderer.material.SetTexture ("_PathTex", m_textures [_this.m_tile.color]);
        p_tile.renderer.material.SetTexture ("_PathMask", m_textures [_this.m_tile.color]);

        // Set the initial position if one does exist.
        if (_this.m_tile.position != null) {
            p_tile.transform.localPosition = new Vector3 (_this.m_tile.position.x * m_offset_x * 1.5f, 0,
                                                     (_this.m_tile.position.y + 1) * m_offset_y);
            Vector3 eulerAngles = new Vector3 (270, 90, 0);
            p_tile.transform.localRotation = Quaternion.Euler (eulerAngles);
        }
    }