Example #1
0
        public void Set(PinSetting[] setting, DMap[] drummap)
        {
            Setting = setting;
            DrumMap = drummap;

            ShowChannels(-1);
        }
Example #2
0
        public override void initialize()
        {
            x = 1;
            y = 7;

            orientation = DGlobal.MapOrientations.NORTH;

            map = new DMap(this.mApp.graphics);
            map.loadMap("TestMap");

            DCharacter testCharacter = new DCharacter(this.mApp.graphics);

            testCharacter.loadCharacter("Goblin");
            testCharacter.setPosition(1, 2);
            map.addCharacter(testCharacter);

            testCharacter = new DCharacter(this.mApp.graphics);
            testCharacter.loadCharacter("Goblin");
            testCharacter.setPosition(2, 4);
            map.addCharacter(testCharacter);

            testCharacter = new DCharacter(this.mApp.graphics);
            testCharacter.loadCharacter("Goblin");
            testCharacter.setPosition(3, 6);
            testCharacter.setRightArmEquipped(true);
            map.addCharacter(testCharacter);
        }
Example #3
0
    void LoadMap(DMap _map = null)
    {
        if (_map == null)
        {
            map = _maploader.MapData;
        }

        foreach (DTileSet ts in map.tilesets)
        {
            LoadTileset(ts);
        }

        if (!prerender_textures)
        {
            PrepareTileset();
        }


        float z = 0.0f;

        foreach (DMapLayer l in map.layers)
        {
            if (l.GetType() == typeof(DMapLayerTiles))
            {
                LoadTileLayer((DMapLayerTiles)l, z);
            }
            if (l.GetType() == typeof(DMapLayerObjects))
            {
                LoadObjectLayer((DMapLayerObjects)l, z);
            }
            z -= 0.1f;
        }
    }
Example #4
0
        public void InitGame()
        {
            MapGen mapGen = new MapGen(_mapWidth, _mapHeight, 50, 20, 5, ++_mapLevel);

            DMap = mapGen.GenerateMap();
            DMap.UpdatePlayerFOV();
            Log      = new Log();
            Commands = new Commands();
            Game._mainConsole.Title = $"RPG - Poziom {_mapLevel}";
        }
Example #5
0
 public void Accept(DMap type, DefField x, List <ResourceInfo> y)
 {
     if (x.IsResource || (type.Type.ValueType is TBean))
     {
         foreach (var e in type.Datas.Values)
         {
             e.Apply(this, x, y);
         }
     }
 }
Example #6
0
        public DrumMapForm(DMap[] DrumMap)
        {
            InitializeComponent();

            foreach (DMap dm in DrumMap)
            {
                lbPads.Items.Add(dm);
            }
            lbPads.SelectedIndex = 0;
        }
        public void Accept(DMap type, TType x, List <ResourceInfo> y)
        {
            TMap mtype = (TMap)x;

            foreach (var(k, v) in type.Datas)
            {
                k.Apply(this, mtype.KeyType, y);
                v.Apply(this, mtype.ValueType, y);
            }
        }
Example #8
0
        public void Accept(DMap type, ByteBuf x)
        {
            Dictionary <DType, DType> datas = type.Datas;

            x.WriteSize(datas.Count);
            foreach (var e in datas)
            {
                e.Key.Apply(this, x);
                e.Value.Apply(this, x);
            }
        }
Example #9
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtName.Text)) return;

            DMap dmap = new DMap();
            dmap.Name = txtName.Text;
            dmap.Head = (byte)nudHead.Value;
            dmap.Rim = (byte)nudRim.Value;
            dmap.Single = cbSingle.Checked;
            lbPads.Items.Add(dmap);
        }
Example #10
0
    public IEnumerator loadMapData(String mapId)
    {
        MapStatus = LoadStatus.Loading;
        String levelFileContent = "";
        String filePathTmx      = Application.persistentDataPath + "/levels/" + mapId + ".tmx";
        String filePathXml      = Application.persistentDataPath + "/levels/" + mapId + ".xml";

        if (!File.Exists(filePathTmx))
        {
            filePathTmx = Application.streamingAssetsPath + "/levels/" + mapId + ".tmx";
        }
        if (!File.Exists(filePathXml))
        {
            filePathXml = Application.streamingAssetsPath + "/levels/" + mapId + ".xml";
        }

        if (File.Exists(filePathTmx) || File.Exists(filePathXml))
        {
            if (File.Exists(filePathTmx))
            {
                levelFileContent = File.ReadAllText(filePathTmx);
            }
            else
            {
                levelFileContent = File.ReadAllText(filePathXml);
            }
        }
        else
        {
            WWW www = new WWW(filePathTmx);
            yield return(www);

            if (www.error == null)
            {
                levelFileContent = www.text;
            }
            else
            {
                levelFileContent = (Resources.Load("levels/" + mapId) as TextAsset).text;
            }
        }

        XmlDocument xmlDoc = new XmlDocument();

        xmlDoc.LoadXml(levelFileContent);
        MapData = new DMap(xmlDoc);
        IEnumerator loadTexture = loadTextureData();

        while (loadTexture.MoveNext())
        {
            yield return(loadTexture.Current);
        }
        MapStatus = LoadStatus.Finished;
    }
Example #11
0
 public virtual void Accept(DMap type, Utf8JsonWriter x)
 {
     x.WriteStartArray();
     foreach (var d in type.Datas)
     {
         x.WriteStartArray();
         d.Key.Apply(this, x);
         d.Value.Apply(this, x);
         x.WriteEndArray();
     }
     x.WriteEndArray();
 }
Example #12
0
 public void Accept(DMap type, StringBuilder x)
 {
     x.Append('{');
     foreach (var e in type.Datas)
     {
         e.Key.Apply(this, x);
         x.Append(':');
         e.Value.Apply(this, x);
         x.Append(',');
     }
     x.Append('}');
 }
Example #13
0
 public void Accept(DMap type, StringBuilder line)
 {
     line.Append('{');
     foreach ((var k, var v) in type.Datas)
     {
         line.Append('[');
         k.Apply(this, line);
         line.Append("]=");
         v.Apply(this, line);
         line.Append(',');
     }
     line.Append('}');
 }
        public override string Accept(DMap type)
        {
            var x = new StringBuilder();

            x.Append('{');
            foreach (var e in type.Datas)
            {
                x.Append('"').Append(e.Key.ToString()).Append('"');
                x.Append(':');
                x.Append(e.Value.Apply(this)).Append(',');
            }
            x.Append('}');
            return(x.ToString());
        }
Example #15
0
 public Informations()
 {
     armys    = new List <ArmyInfo>();
     mine     = new ArmyInfo();
     captures = new DMap <int, StatCapture>();
     dungeons = new Dictionary <int, StatDungeon>();
     statVip  = new StatVip();
     statSign = new StatSign();
     statRole = new StatRole();
     statRole.RandomGenerate();
     statChat                  = new StatChat();
     statDugeonChapterMap      = new StatDugeonChapterMap();
     statDugeonChapterMapElite = new StatDugeonChapterMap();
     InitArmy();
     InitDefaultGeneralsInfo();
 }
 public int Accept(DMap data, TType type, Title x)
 {
     SetTitleValue(x, data.Apply(ToExcelStringVisitor.Ins, type.GetTag("sep")));
     return(1);
 }
Example #17
0
 public bool Accept(DMap type)
 {
     return(type.Datas.Count == 0);
 }
Example #18
0
 public void Accept(DMap type, RawTextTable x)
 {
 }
Example #19
0
 public abstract string Accept(DMap type);
Example #20
0
 public void Accept(DMap type, DefAssembly x)
 {
     throw new NotImplementedException();
 }
Example #21
0
        public void Accept(DBean record, DefAssembly assembly)
        {
            if (record.ImplType == null)
            {
                return;
            }
            var defFields = record.ImplType.HierarchyFields;
            int i         = 0;

            foreach (var fieldValue in record.Fields)
            {
                var defField = (DefField)defFields[i++];
                _path.Push(defField.Name);
                switch (defField.CType)
                {
                case TArray a:
                {
                    if (defField.ValueValidators.Count > 0)
                    {
                        var arr   = (DArray)fieldValue;
                        int index = 0;
                        foreach (var value in arr.Datas)
                        {
                            _path.Push(index++);
                            foreach (var v in defField.ValueValidators)
                            {
                                v.Validate(Ctx, value, defField.IsNullable);
                            }
                            _path.Pop();
                        }
                    }
                    if (a.ElementType is TBean)
                    {
                        var arr   = (DArray)fieldValue;
                        int index = 0;
                        foreach (var value in arr.Datas)
                        {
                            _path.Push(index++);
                            Accept((DBean)value, assembly);
                            _path.Pop();
                        }
                    }
                    break;
                }

                case TList b:
                {
                    if (defField.ValueValidators.Count > 0)
                    {
                        var arr   = (DList)fieldValue;
                        int index = 0;
                        foreach (var value in arr.Datas)
                        {
                            _path.Push(index++);
                            foreach (var v in defField.ValueValidators)
                            {
                                v.Validate(Ctx, value, false);
                            }
                            _path.Pop();
                        }
                    }
                    if (b.ElementType is TBean tb)
                    {
                        var arr   = (DList)fieldValue;
                        int index = 0;
                        foreach (var value in arr.Datas)
                        {
                            _path.Push(index++);
                            Accept((DBean)value, assembly);
                            _path.Pop();
                        }


                        if (defField.IndexField != null)
                        {
                            var indexSet = new HashSet <DType>();
                            if (!tb.GetBeanAs <DefBean>().TryGetField(defField.Index, out var _, out var indexOfIndexField))
                            {
                                throw new Exception("impossible");
                            }
                            foreach (var value in arr.Datas)
                            {
                                _path.Push(index++);
                                DType indexValue = ((DBean)value).Fields[indexOfIndexField];
                                if (!indexSet.Add(indexValue))
                                {
                                    throw new Exception($"{TypeUtil.MakeFullName(_path)} index:{indexValue} 重复");
                                }
                                _path.Pop();
                            }
                        }
                    }
                    break;
                }

                case TSet c:
                {
                    if (defField.ValueValidators.Count > 0)
                    {
                        var arr = (DSet)fieldValue;
                        foreach (var value in arr.Datas)
                        {
                            foreach (var v in defField.ValueValidators)
                            {
                                v.Validate(Ctx, value, false);
                            }
                        }
                    }
                    break;
                }

                case TMap m:
                {
                    DMap map = (DMap)fieldValue;
                    if (defField.KeyValidators.Count > 0)
                    {
                        foreach (var key in map.Datas.Keys)
                        {
                            _path.Push(key);
                            foreach (var v in defField.KeyValidators)
                            {
                                v.Validate(Ctx, key, false);
                            }
                            _path.Pop();
                        }
                    }
                    if (defField.ValueValidators.Count > 0)
                    {
                        foreach (var value in map.Datas.Values)
                        {
                            _path.Push(value);
                            foreach (var v in defField.ValueValidators)
                            {
                                v.Validate(Ctx, value, false);
                            }

                            if (value is DBean dv)
                            {
                                Accept(dv, assembly);
                            }
                            _path.Pop();
                        }
                    }
                    break;
                }

                case TBean n:
                {
                    Accept((DBean)fieldValue, assembly);
                    break;
                }

                default:
                {
                    if (defField.Validators.Count > 0)
                    {
                        foreach (var v in defField.Validators)
                        {
                            v.Validate(Ctx, fieldValue, defField.IsNullable);
                        }
                    }
                    break;
                }
                }
                _path.Pop();
            }
        }
Example #22
0
 public Informations()
 {
     armys = new List<ArmyInfo>();
     mine = new ArmyInfo();
     captures = new DMap<int, StatCapture>();
     dungeons = new Dictionary<int, StatDungeon>();
     statVip = new StatVip();
     statSign = new StatSign();
     statRole = new StatRole();
     statRole.RandomGenerate();
     statChat = new StatChat();
     statDugeonChapterMap = new StatDugeonChapterMap();
     statDugeonChapterMapElite = new StatDugeonChapterMap();
     InitArmy();
     InitDefaultGeneralsInfo();
 }
Example #23
0
 public void Draw(DMap[] DrumMap, PinSetting[] Setting, HHSetting hhSetting)
 {
     _DrumMap = DrumMap;
     _Setting = Setting;
     _hhSetting = hhSetting;
 }