public Type7File(Type7Descriptor desc,int start,int frames):base(desc) { numFrames=frames; if(desc!=null) { this.numFrames=desc.NumFrames; start = desc.StartIdx; } int[,] curr = new int[8,numFrames]; // Console.WriteLine("North:"); int x=0; for(int pos=0;pos<8;pos++) for(int fram=0;fram<numFrames;fram++) { curr[pos,fram]=start+(pos*numFrames*4)+x+fram; //Console.Write((start+(pos*numFrames*4)+x+fram)+" "); } north = new MovingPartDirection(curr); curr = new int[8,numFrames]; // Console.WriteLine("\nEast:"); x=numFrames; for(int pos=0;pos<8;pos++) for(int fram=0;fram<numFrames;fram++) { curr[pos,fram]=start+(pos*numFrames*4)+x+fram; // Console.Write((start+(pos*numFrames*4)+x+fram)+" "); } east = new MovingPartDirection(curr); curr = new int[8,numFrames]; // Console.WriteLine("\nWest:"); x=numFrames*2; for(int pos=0;pos<8;pos++) for(int fram=0;fram<numFrames;fram++) { curr[pos,fram]=start+(pos*numFrames*4)+x+fram; // Console.Write((start+(pos*numFrames*4)+x+fram)+" "); } west = new MovingPartDirection(curr); curr = new int[8,numFrames]; // Console.WriteLine("\nSouth:"); x=numFrames*3; for(int pos=0;pos<8;pos++) for(int fram=0;fram<numFrames;fram++) { curr[pos,fram]=start+(pos*numFrames*4)+x+fram; // Console.Write((start+(pos*numFrames*4)+x+fram)+" "); } south = new MovingPartDirection(curr); }
public UnitInfo(Stream file,VarCollection v):this() { StreamReader sr = new StreamReader(file); VarCollection vars = new VarCollection(sr,v); KeyVal line=vars.ReadLine(); if(line==null) return; groundImages = line.Rest; while((line=vars.ReadLine())!=null) { if(line.Keyword=="unit") { string name = line.Rest; line = vars.ReadLine(); if(line.Keyword=="type") { int type = int.Parse(line.Rest); switch(type) { case 0: units[name] = new Type0Descriptor(name,sr,vars); break; case 1: units[name] = new Type1Descriptor(name,sr,vars); break; case 2: units[name] = new Type2Descriptor(name,sr,vars); break; case 3: units[name] = new Type3Descriptor(name,sr,vars); break; case 4: units[name] = new Type4Descriptor(name,sr,vars); break; case 5: units[name] = new Type5Descriptor(name,sr,vars); break; case 6: units[name] = new Type6Descriptor(name,sr,vars); break; case 7: units[name] = new Type7Descriptor(name,sr,vars); break; } } } else { xConsole.AddLine("Unknown keyword parsing unit file(1): "+line.Keyword+"->"+line.Rest); } } sr.Close(); }
public Type7File(Type7Descriptor desc, int start, int frames) : base(desc) { numFrames = frames; if (desc != null) { this.numFrames = desc.NumFrames; start = desc.StartIdx; } int[,] curr = new int[8, numFrames]; // Console.WriteLine("North:"); int x = 0; for (int pos = 0; pos < 8; pos++) { for (int fram = 0; fram < numFrames; fram++) { curr[pos, fram] = start + (pos * numFrames * 4) + x + fram; //Console.Write((start+(pos*numFrames*4)+x+fram)+" "); } } north = new MovingPartDirection(curr); curr = new int[8, numFrames]; // Console.WriteLine("\nEast:"); x = numFrames; for (int pos = 0; pos < 8; pos++) { for (int fram = 0; fram < numFrames; fram++) { curr[pos, fram] = start + (pos * numFrames * 4) + x + fram; // Console.Write((start+(pos*numFrames*4)+x+fram)+" "); } } east = new MovingPartDirection(curr); curr = new int[8, numFrames]; // Console.WriteLine("\nWest:"); x = numFrames * 2; for (int pos = 0; pos < 8; pos++) { for (int fram = 0; fram < numFrames; fram++) { curr[pos, fram] = start + (pos * numFrames * 4) + x + fram; // Console.Write((start+(pos*numFrames*4)+x+fram)+" "); } } west = new MovingPartDirection(curr); curr = new int[8, numFrames]; // Console.WriteLine("\nSouth:"); x = numFrames * 3; for (int pos = 0; pos < 8; pos++) { for (int fram = 0; fram < numFrames; fram++) { curr[pos, fram] = start + (pos * numFrames * 4) + x + fram; // Console.Write((start+(pos*numFrames*4)+x+fram)+" "); } } south = new MovingPartDirection(curr); }
public Type7File(Type7Descriptor desc) : this(desc, 0, 4) { }
public UnitInfo(Stream file, VarCollection v) : this() { StreamReader sr = new StreamReader(file); VarCollection vars = new VarCollection(sr, v); KeyVal line = vars.ReadLine(); if (line == null) { return; } groundImages = line.Rest; while ((line = vars.ReadLine()) != null) { if (line.Keyword == "unit") { string name = line.Rest; line = vars.ReadLine(); if (line.Keyword == "type") { int type = int.Parse(line.Rest); switch (type) { case 0: units[name] = new Type0Descriptor(name, sr, vars); break; case 1: units[name] = new Type1Descriptor(name, sr, vars); break; case 2: units[name] = new Type2Descriptor(name, sr, vars); break; case 3: units[name] = new Type3Descriptor(name, sr, vars); break; case 4: units[name] = new Type4Descriptor(name, sr, vars); break; case 5: units[name] = new Type5Descriptor(name, sr, vars); break; case 6: units[name] = new Type6Descriptor(name, sr, vars); break; case 7: units[name] = new Type7Descriptor(name, sr, vars); break; } } } else { xConsole.AddLine("Unknown keyword parsing unit file(1): " + line.Keyword + "->" + line.Rest); } } sr.Close(); }
public Type7File(Type7Descriptor desc):this(desc,0,4){}