Пример #1
0
 public void UnShow(MapNode node)
 {
     throw new System.NotImplementedException();
 }
Пример #2
0
 public void UnShow(MapNode node)
 {
 }
Пример #3
0
        public void Show(MapNode node, Vector2Int index)
        {
            Vector2Int   currentIndex = node.index;
            Vector2Int   unit         = MapManager.Instance.mapUnit;
            MeshRenderer mr;

            if (renderers.ContainsKey(currentIndex) && renderers[currentIndex] != null)
            {
                mr = renderers[node.index];
            }
            else
            {
                GameObject panel = GameObject.CreatePrimitive(PrimitiveType.Quad);
                panel.name = node.index.ToString();
                panel.transform.position   = new Vector3(node.index.x * MapManager.Instance.mapUnit.x + 16, 0, node.index.y * MapManager.Instance.mapUnit.y + 16);
                panel.transform.rotation   = Quaternion.AngleAxis(90, Vector3.right);
                panel.transform.localScale = new Vector3(node.size.x, node.size.y, 1);
                mr = panel.GetComponent <MeshRenderer>();
                textures[currentIndex]  = new Texture2D(1024, 1024);//,TextureFormat.ARGB32,false);
                mr.material             = mapManager.groundMaterial;
                mr.material.mainTexture = textures[currentIndex];
                renderers[currentIndex] = mr;
            }
            Dictionary <byte, byte> cid = new Dictionary <byte, byte>();

            for (byte i = 0; i < node.Data.coners.GetLength(2); i++)
            {
                if (node.Data.coners[index.x, index.y, i] == 0)
                {
                    continue;
                }
                if (cid.ContainsKey(node.Data.coners[index.x, index.y, i]))
                {
                    cid[node.Data.coners[index.x, index.y, i]] += (byte)(i + 1);
                }
                else
                {
                    cid[node.Data.coners[index.x, index.y, i]] = i;
                }
            }

            enumraterConerDic = cid.GetEnumerator();
            Color targetColor = Color.white;

            textures[currentIndex].SetPixels(index.x * unit.x, index.y * unit.y, unit.x, unit.y, BrushManager.Instance.gourndTextures[enumraterConerDic.Current.Key].GetPixels(0, 0, 32, 32));
            while (enumraterConerDic.MoveNext())
            {
                for (int i = 0; i < unit.x; i++)
                {
                    for (int j = 0; j < unit.y; j++)
                    {
                        targetColor = BrushManager.Instance.gourndTextures[enumraterConerDic.Current.Key].GetPixel((enumraterConerDic.Current.Value + 1) * unit.x + i, j);
                        if (targetColor.a != 0)
                        {
                            textures[currentIndex].SetPixel(index.x * unit.x + i, index.y * unit.y + j, BrushManager.Instance.gourndTextures[enumraterConerDic.Current.Key].GetPixel((enumraterConerDic.Current.Value + 1) * unit.x + i, j));
                        }
                    }
                }
                //textures[currentIndex].SetPixels(index.x * unit.x, index.y * unit.y, unit.x, unit.y, BrushManager.Instance.gourndTextures[enumraterConerDic.Current.Key].GetPixels((enumraterConerDic.Current.Value + 1) * unit.x, 0, unit.x, unit.y));
            }



            updateTexture[node.index] = true;
        }
Пример #4
0
 public void CreateMap(MapNode node)
 {
 }
Пример #5
0
 public void ShowMark(MapNode node, Vector2Int index)
 {
 }