Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     Africa_map = Africa.GetComponent<map>();
     Asia_map = Asia.GetComponent<map>();
     Australia_map = Australia.GetComponent<map>();
     Europe_map = Europe.GetComponent<map>();
     NorthAmerica_map = NorthAmerica.GetComponent<map>();
     SouthAmerica_map = SouthAmerica.GetComponent<map>();
 }
Ejemplo n.º 2
0
 private void loadMap(int a)
 {
     currMap = a;
     Map     = content.maps[a];
     for (var _a = 0; _a < Pigs.Length; _a++)
     {
         Pigs[_a].Dispose();
     }
     Pigs = new Pig[Map.pigs.GetLength(0)];
     for (var _a = 0; _a < Pigs.Length; _a++)
     {
         Pigs[_a] = new Pig(_a);
     }
     player.init(Map.start);
 }
Ejemplo n.º 3
0
    static void Main()
    {
        m = make_map <@string, ptr <Vertex> >();

        // Here be dragons - don't let the local struct leave the stack! At the very point
        // where code detects an escape route for the stack allocated structure in the local
        // function, code has to use a heap allocated instance of the structure. That said,
        // the detection "should" be as simple as encountering any address-of operator "&"
        // for the variable within the local function. A detailed analysis of the code path
        // might show that a simple pointer (or safe ref var) would do the trick as long as
        // pointer doesn't escape to the heap later. Such an operation could be optimal
        // because there would be no required heap allocation. Interestingly, Go actually
        // has a compiler directive called "go.noescape" which indicates exactly this, but
        // it's only used with external CGO imports.
        ref var v1 = ref heap(new Vertex(
Ejemplo n.º 4
0
        static void  Test()
        {
            Vector3 v = new Vector3(1, 2, 3);

            v *= 10;
            v /= 3;
            StringA            str = "abc";
            map <int, StringA> m   = new map <int, StringA>();

            m[1] = "a";
            m[2] = "b";
            for (iterator <int, StringA> it = m.begin(); it; ++it)
            {
            }
        }
Ejemplo n.º 5
0
    private void XmlSerializeData()
    {
        map        mapData = new map();
        mapTileset tileset = new mapTileset();

        tileset.firstgid = 1;
        tileset.source   = "baba.tsx";
        mapData.tileset  = tileset;

        mapLayer mapLayerIns = new mapLayer();

        mapLayerIns.id     = 1;
        mapLayerIns.name   = "Tile Layer 1";
        mapLayerIns.width  = 5;
        mapLayerIns.height = 6;
        mapLayerData dataField = new mapLayerData();

        dataField.encoding = "csv";
        dataField.Value    = @"1, 2, 3, 4, 5, 
7, 8, 9, 10, 11, 
13, 14, 15, 16, 17, 
19, 20, 21, 22, 23, 
25, 26, 27, 28, 29, 
31, 32, 33, 34, 35";
        mapLayerIns.data   = dataField;
        mapData.layer      = mapLayerIns;

        //< map version = "1.2" tiledversion = "1.3.1" orientation = "orthogonal" renderorder = "right-down" compressionlevel = "-1" width = "5" height = "6" tilewidth = "16" tileheight = "16" infinite = "0" nextlayerid = "2" nextobjectid = "1" >
        mapData.version          = 1.2m;
        mapData.tiledversion     = "1.3.1";
        mapData.orientation      = "orthogonal";
        mapData.renderorder      = "right-down";
        mapData.compressionlevel = -1;
        mapData.width            = 5;
        mapData.height           = 6;
        mapData.tilewidth        = 16;
        mapData.tileheight       = 16;
        mapData.infinite         = 0;
        mapData.nextlayerid      = 2;
        mapData.nextobjectid     = 1;


        XmlSerializer serializer = new XmlSerializer(mapData.GetType());
        StreamWriter  writer     = new StreamWriter("test.tmx");

        serializer.Serialize(writer.BaseStream, mapData);
        writer.Close();
    }
    //execute
    global void execute(Database.BatchableContext BC, List <sObject> scope)
    {
        Set <ID> setContactIDs = new Set <ID>();

        try
        {
            //1. get all ContactIDs for scoped subscriptions
            for (Subscription__c sub:(List <Subscription__c>)scope)
            {
                System.debug('sub:' + sub);
                setContactIDs.add(sub.Contact__c);
            }

            //2. get all subscriptions for the set of contacts - into map-of-contact_And_ListOfSubscriptions
            map <ID, List <Subscription__c> > mapContactAndSubscriptionsList = new map <ID, List <Subscription__c> >();
            for (Subscription__c sub:([SELECT id, contact__c, VerifiedDate__c, contact__r.VerifiedDate__c from Subscription__c
Ejemplo n.º 7
0
        private void tableGridView_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataRow row = ui.getDataGridViewCurrentRow(tableGridView);

            string[] columnNames = ui.getDataGridViewColName(tableGridView);
            map[]    temp        = new map[tableGridView.Columns.Count];
            for (int i = 0; i < tableGridView.Columns.Count; i++)
            {
                temp[i]       = new map();
                temp[i].Text  = columnNames[i];
                temp[i].Value = row[columnNames[i]].ToString();
            }

            ui.setCurrentEdit(temp);
            ui.dynamicPanel(editPanel, temp);
        }
Ejemplo n.º 8
0
                    // ShouldBuild reports whether it is okay to use this file,
                    // The rule is that in the file's leading run of // comments
                    // and blank lines, which must be followed by a blank line
                    // (to avoid including a Go package clause doc comment),
                    // lines beginning with '// +build' are taken as build directives.
                    //
                    // The file is accepted only if each such line lists something
                    // matching the file. For example:
                    //
                    //    // +build windows linux
                    //
                    // marks the file as applicable only on Windows and Linux.
                    //
                    // If tags["*"] is true, then ShouldBuild will consider every
                    // build tag except "ignore" to be both true and false for
                    // the purpose of satisfying build tags, in order to estimate
                    // (conservatively) whether a file could ever possibly be used
                    // in any build.
                    //
                    public static bool ShouldBuild(slice <byte> content, map <@string, bool> tags)
                    {
                        // Pass 1. Identify leading run of // comments and blank lines,
                        // which must be followed by a blank line.
                        long end = 0L;
                        var  p   = content;

                        while (len(p) > 0L)
                        {
                            var line = p;
                            {
                                var i__prev1 = i;

                                var i = bytes.IndexByte(line, '\n');

                                if (i >= 0L)
                                {
                                    line = line[..i];
Ejemplo n.º 9
0
    void initGame()
    {
        player     = GameObject.FindGameObjectWithTag("Player").GetComponent <player>();
        mapManager = GetComponent <map>();
        mapManager.initMap();

        foodText         = GameObject.Find("foodText").GetComponent <Text>();
        failText         = GameObject.Find("gameFailure").GetComponent <Text>();
        failText.enabled = false;
        updateFoodText(0);
        dayImage     = GameObject.Find("dayImage").GetComponent <Image>();
        dayText      = GameObject.Find("dayText").GetComponent <Text>();
        dayText.text = "Day " + level;
        Invoke("HideBlack", 1);

        isEnd = false;
        enemyList.Clear();
    }
Ejemplo n.º 10
0
        private AntsX.TMXTiledMap.map loadTMXMapFromFile(string filename)
        {
            map       m = null;
            Exception e;

            if (!TMX <map> .LoadFromFile(filename, out m, out e))
            {
                throw e;
            }
            else
            {
                if (m == null)
                {
                    throw new ArgumentNullException();
                }
            }
            return(m);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            tileSource = new Rectangle[4];
            IsMouseVisible = true;
            p1 = new Player(Content, startRect, 1, 1);
            

            allies = new List<Ally>() { testAlly };
            enemies = new List<Enemy>() { testEnemy };
            combat = new Combat(this.Content, allies, enemies);

            tileSource[0] = new Rectangle(0, 0, 50, 50); // grass
            tileSource[1] = new Rectangle(50, 0, 50, 50); // flowers
            tileSource[2] = new Rectangle(100, 0, 50, 50); // street
            tileSource[3] = new Rectangle(150, 0, 50, 50); // wood

            this.Window.AllowUserResizing = true;

            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 800;
            graphics.ApplyChanges();


            buildings = new Dictionary<string, Building>();
            insideBuilds = new Dictionary<string, Building>();

            maps = new List<Tile[,]>();
            maps.Add(new Tile[16, 16]); //Town
            maps.Add(new Tile[16, 16]); //ConsShop
            maps.Add(new Tile[16, 16]); //EquiShop
            maps.Add(new Tile[16, 16]); //Hospital
            maps.Add(new Tile[16, 16]); //Inn
            maps.Add(new Tile[16, 16]); //Bank
            maps.Add(new Tile[16, 16]); //Wild1
            maps.Add(new Tile[16, 16]); //Wild2
            maps.Add(new Tile[16, 16]); //Wild3

            screen = new Rectangle(0, 0, 800, 800);
            fade = new Color(0, 0, 0, 100);

            currentMap = map.Wild2;//Later, change this to begin in the wilderness
            base.Initialize();
        }
Ejemplo n.º 12
0
        private void button_testCollision_Click(object sender, EventArgs e)
        {
            map gameMap = game.getMap();

            gameMap.clearMap();

            airplane airplane1 = new airplane(gameMap);
            Random   random    = new Random();

            airplane1.Initialize(
                "T1",
                this.game.icons.ElementAt(0).Value,
                "TEST CRASH",
                "1",
                new Vector2(gameMap.getSize().X / 2, gameMap.getSize().Y * 0.75f),
                utilVector2.getDirectionFromString("Up"),
                Game1.minMaxAltitude[1],
                random.Next(Game1.minMaxMAXSpeed[0], Game1.minMaxMAXSpeed[1]),
                random.Next(Game1.minMaxMAXSpeed[0], Game1.minMaxMAXSpeed[1]),
                random.Next(Game1.minMaxAcceleration[0], Game1.minMaxAcceleration[1]),
                random.Next(Game1.minMaxVerticalAcceleration[0], Game1.minMaxVerticalAcceleration[1]),
                random.Next(Game1.minMaxCapacity[0], Game1.minMaxCapacity[1])
                );

            airplane airplane2 = new airplane(gameMap);

            airplane2.Initialize(
                "T2",
                this.game.icons.ElementAt(0).Value,
                "TEST CRASH",
                "2",
                new Vector2(gameMap.getSize().X / 2, gameMap.getSize().Y * 0.25f),
                utilVector2.getDirectionFromString("Down"),
                Game1.minMaxAltitude[1],
                random.Next(Game1.minMaxMAXSpeed[0], Game1.minMaxMAXSpeed[1]),
                random.Next(Game1.minMaxMAXSpeed[0], Game1.minMaxMAXSpeed[1]),
                random.Next(Game1.minMaxAcceleration[0], Game1.minMaxAcceleration[1]),
                random.Next(Game1.minMaxVerticalAcceleration[0], Game1.minMaxVerticalAcceleration[1]),
                random.Next(Game1.minMaxCapacity[0], Game1.minMaxCapacity[1])
                );

            this.game.addAirplaneToMap(airplane1);
            this.game.addAirplaneToMap(airplane2);
        }
Ejemplo n.º 13
0
 // Start is called before the first frame update
 void Start()
 {
     canAct  = true;
     current = 0;
     levelButtons[current].transform.localScale = selectedScale;
     skyInfoText.SetActive(false);
     levelChosen = map.forest;
     //check unlock
     if (!graveyardUnlocked)
     {
         levelButtons[1].GetComponent <Button>().interactable = false;
         levelButtons[1].GetComponent <Image>().color         = lockedColor;
     }
     if (!skyUnlocked)
     {
         levelButtons[2].GetComponent <Button>().interactable = false;
         levelButtons[2].GetComponent <Image>().color         = lockedColor;
     }
 }
Ejemplo n.º 14
0
    Movement getPlayerMovement(int field)
    {
        Movement returnMovement;

        //MapID holen

        map             Map = new map();
        List <Movement> map = Map.getMap(GameSettings.getMapID());

        if (field >= map.Count)
        {
            returnMovement = map[map.Count - 1];
        }
        else
        {
            returnMovement = map[field];
        }

        return(returnMovement);
    }
Ejemplo n.º 15
0
 public importer(map <@string, ptr <types.Package> > imports = default, slice <byte> data = default, @string importpath = default, slice <byte> buf = default, long version = default, slice <@string> strList = default, slice <@string> pathList = default, slice <ptr <types.Package> > pkgList = default, slice <types.Type> typList = default, slice <ptr <types.Interface> > interfaceList = default, bool trackAllTypes = default, bool posInfoFormat = default, @string prevFile = default, long prevLine = default, fakeFileSet fake = default, bool debugFormat = default, long read = default)
 {
     this.imports       = imports;
     this.data          = data;
     this.importpath    = importpath;
     this.buf           = buf;
     this.version       = version;
     this.strList       = strList;
     this.pathList      = pathList;
     this.pkgList       = pkgList;
     this.typList       = typList;
     this.interfaceList = interfaceList;
     this.trackAllTypes = trackAllTypes;
     this.posInfoFormat = posInfoFormat;
     this.prevFile      = prevFile;
     this.prevLine      = prevLine;
     this.fake          = fake;
     this.debugFormat   = debugFormat;
     this.read          = read;
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Choose map file to load.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void open_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Mapfiles (*.xml)|*.xml";

            XmlSerializer serial = new XmlSerializer(typeof(map));

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                using (Stream stream = ofd.OpenFile())
                {
                    thisMap = serial.Deserialize(stream) as map;
                }
            }

            pictureBox1.Size = new Size(thisMap.width * ticks, thisMap.height * ticks);

            refresh_Click(sender, e);
        }
Ejemplo n.º 17
0
 public void move(int[] relativePosition, map gameMap)
 {
     if (position[0] + relativePosition[0] < 8 &&
         position[0] + relativePosition[0] > -1)
     {
         if (position[1] + relativePosition[1] < 8 &&
             position[1] + relativePosition[1] > -1)
         {
             if (gameMap.findPiece(new int[] { position[0] + relativePosition[0], position[1] + relativePosition[1] }) == null)
             {
                 if (!gameMap.isThereAJump())
                 {
                     position[0]        += relativePosition[0];
                     position[1]        += relativePosition[1];
                     gameMap.player1Turn = !gameMap.player1Turn;
                 }
             }
             else if (gameMap.findPiece(new int[] { position[0] + (relativePosition[0] * 2), position[1] + (relativePosition[1] * 2) }) == null &&
                      position[0] + (relativePosition[0] * 2) < 8 &&
                      position[0] + (relativePosition[0] * 2) > -1)
             {
                 if (position[1] + (relativePosition[1] * 2) < 8 &&
                     position[1] + (relativePosition[1] * 2) > -1 && gameMap.findPiece(new int[] { position[0] + relativePosition[0], position[1] + relativePosition[1] }).value != value)
                 {
                     gameMap.findPiece(new int[] { position[0] + relativePosition[0], position[1] + relativePosition[1] }).dead = true;
                     position[0] += relativePosition[0] * 2;
                     position[1] += relativePosition[1] * 2;
                     if (gameMap.checkTurnOver(this))
                     {
                         gameMap.player1Turn = !gameMap.player1Turn;
                     }
                 }
             }
         }
     }
     if ((position[1] == 7 && value == map.player1) ||
         (position[1] == 0 && value == map.player2))
     {
         king = true;
     }
 }
Ejemplo n.º 18
0
 public Loader(map <ptr <oReader>, Sym> start = default, slice <objIdx> objs = default, Sym max = default, Sym extStart = default, slice <nameVer> extSyms = default, slice <Sym> builtinSyms = default, long ocache = default, array <map <@string, Sym> > symsByName = default, map <nameVer, Sym> extStaticSyms = default, map <Sym, Sym> overwrite = default, map <@string, ptr <oReader> > objByPkg = default, slice <ptr <sym.Symbol> > Syms = default, long anonVersion = default, bitmap Reachable = default, slice <Sym> Reachparent = default, slice <sym.Reloc> relocBatch = default, uint flags = default, long strictDupMsgs = default)
 {
     this.start         = start;
     this.objs          = objs;
     this.max           = max;
     this.extStart      = extStart;
     this.extSyms       = extSyms;
     this.builtinSyms   = builtinSyms;
     this.ocache        = ocache;
     this.symsByName    = symsByName;
     this.extStaticSyms = extStaticSyms;
     this.overwrite     = overwrite;
     this.objByPkg      = objByPkg;
     this.Syms          = Syms;
     this.anonVersion   = anonVersion;
     this.Reachable     = Reachable;
     this.Reachparent   = Reachparent;
     this.relocBatch    = relocBatch;
     this.flags         = flags;
     this.strictDupMsgs = strictDupMsgs;
 }
Ejemplo n.º 19
0
    // Use this for initialization
    void Start()
    {
        cube = new Cube
        {
            light_cube = light,
            dark_cube  = dark,
            edge_cube  = edge,
            fly_trap   = fly,
            thorn_trap = thorn,
            null_cube  = nul
        };
        map = new map(cube);
        transform.position = new Vector3(3.535534f, 2, 4.949748f); //初始化位置
        transform.Rotate(new Vector3(0, 45, 0));
        //3.546116,16.63684,6.88186
        GameObject camera = GameObject.Find("Main Camera");

        camera.transform.position        = new Vector3(3.546116f, 16.63684f, 6.88186f);
        camera.GetComponent <camera>().z = camera.transform.position.z - transform.position.z;

        InvokeRepeating("Old", 0.1f, 0.1f);
    }
Ejemplo n.º 20
0
    // Step 1 切换地图后首先调用,根据MaskBuffer数据 初始化Map
    public void InitMap(int width, int height, byte[] MaskBuffer)
    {
        m_TexWidth  = width;
        m_TexHeight = height;
        m_BlockMap  = new map(width, height);

        for (int y = 0; y < m_TexHeight; ++y)
        {
            for (int x = 0; x < m_TexWidth; ++x)
            {
                int number = x + m_TexWidth * y;
                int index  = number / 8;
                int bit    = number % 8;

                if (index < MaskBuffer.Length)
                {
                    bool bBlock = ((MaskBuffer[index] & (1 << bit)) > 0); // 大于0,表示有阻挡
                    m_BlockMap.initBlock(x, y, bBlock);
                }
            }
        }
    }
Ejemplo n.º 21
0
                    // readVendorList reads the list of vendored modules from vendor/modules.txt.
                    private static void readVendorList()
                    {
                        vendorOnce.Do(() =>
                        {
                            vendorList      = null;
                            vendorPkgModule = make_map <@string, module.Version>();
                            vendorVersion   = make_map <@string, @string>();
                            vendorMeta      = make_map <module.Version, vendorMetadata>();
                            var(data, err)  = ioutil.ReadFile(filepath.Join(ModRoot(), "vendor/modules.txt"));
                            if (err != null)
                            {
                                if (!errors.Is(err, os.ErrNotExist))
                                {
                                    @base.Fatalf("go: %s", err);
                                }

                                return;
                            }

                            module.Version mod = default;
                            foreach (var(_, line) in strings.Split(string(data), "\n"))
                            {
                                if (strings.HasPrefix(line, "# "))
                                {
                                    var f = strings.Fields(line);

                                    if (len(f) < 3L)
                                    {
                                        continue;
                                    }

                                    if (semver.IsValid(f[2L]))
                                    {
                                        // A module, but we don't yet know whether it is in the build list or
                                        // only included to indicate a replacement.
                                        mod = new module.Version(Path: f[1], Version: f[2]);
                                        f   = f[3L..];
                                    }
Ejemplo n.º 22
0
        private void button_addRandomAirplane_Click(object sender, EventArgs e)
        {
            map      gameMap         = game.getMap();
            airplane airplane        = new airplane(gameMap);
            Random   random          = new Random();
            Vector2  chosenDirection = utilVector2.getRandomDirection();

            airplane.Initialize(
                this.game.generateRandomId(),
                this.game.icons.ElementAt(0).Value,
                "xd",
                "xd",
                new Vector2(random.Next(1, (int)gameMap.getSize().X), random.Next(1, (int)gameMap.getSize().Y)),
                chosenDirection,
                random.Next(Game1.minMaxAltitude[0], Game1.minMaxAltitude[1]),
                random.Next(Game1.minMaxMAXSpeed[0], Game1.minMaxMAXSpeed[1]),
                random.Next(Game1.minMaxMAXSpeed[0], Game1.minMaxMAXSpeed[1]),
                random.Next(Game1.minMaxAcceleration[0], Game1.minMaxAcceleration[1]),
                random.Next(Game1.minMaxVerticalAcceleration[0], Game1.minMaxVerticalAcceleration[1]),
                random.Next(Game1.minMaxCapacity[0], Game1.minMaxCapacity[1])
                );

            this.game.addAirplaneToMap(airplane);
        }
Ejemplo n.º 23
0
 public T11(map <long, @string> value) => m_value = value;
Ejemplo n.º 24
0
 public shortcuts(map <@string, slice <@string> > value) => m_value = value;
Ejemplo n.º 25
0
 public factsTable(bool unsat = default, long unsatDepth = default, map <pair, relation> facts = default, slice <fact> stack = default, ref ptr <poset> orderS = default, ref ptr <poset> orderU = default, map <ID, limit> limits = default, slice <limitFact> limitStack = default, map <ID, ptr <Value> > lens = default, map <ID, ptr <Value> > caps = default, ref ptr <Value> zero = default)
 {
     this.unsat      = unsat;
     this.unsatDepth = unsatDepth;
     this.facts      = facts;
     this.stack      = stack;
     this.orderS     = orderS;
     this.orderU     = orderU;
     this.limits     = limits;
     this.limitStack = limitStack;
     this.lens       = lens;
     this.caps       = caps;
     this.zero       = zero;
 }
Ejemplo n.º 26
0
 public Program(ref ptr <token.FileSet> Fset = default, map <@string, ptr <Package> > imported = default, map <ptr <types.Package>, ptr <Package> > packages = default, BuilderMode mode = default, typeutil.MethodSetCache MethodSets = default, sync.Mutex methodsMu = default, typeutil.Map methodSets = default, typeutil.Map runtimeTypes = default, typeutil.Map canon = default, map <ptr <types.Func>, ptr <Function> > bounds = default, map <selectionKey, ptr <Function> > thunks = default)
 {
     this.Fset         = Fset;
     this.imported     = imported;
     this.packages     = packages;
     this.mode         = mode;
     this.MethodSets   = MethodSets;
     this.methodsMu    = methodsMu;
     this.methodSets   = methodSets;
     this.runtimeTypes = runtimeTypes;
     this.canon        = canon;
     this.bounds       = bounds;
     this.thunks       = thunks;
 }
Ejemplo n.º 27
0
 public exporter(ref ptr <token.FileSet> fset = default, bytes.Buffer @out = default, map <@string, long> strIndex = default, map <ptr <types.Package>, long> pkgIndex = default, map <types.Type, long> typIndex = default, bool posInfoFormat = default, @string prevFile = default, long prevLine = default, long written = default, long indent = default)
 {
     this.fset          = fset;
     this.@out          = @out;
     this.strIndex      = strIndex;
     this.pkgIndex      = pkgIndex;
     this.typIndex      = typIndex;
     this.posInfoFormat = posInfoFormat;
     this.prevFile      = prevFile;
     this.prevLine      = prevLine;
     this.written       = written;
     this.indent        = indent;
 }
Ejemplo n.º 28
0
 protected void Page_Load(object sender, EventArgs e)
 {
     map a = new map();
 }
 private void CheckIfCanBeMap(set set, @class entity)
 {
     if (set.Item is onetomany)
     {
         var collectedEntity = context.Model.GetClassFromEntityName((set.Item as onetomany).@class);
         if (collectedEntity.Item is compositeid)
         {
             var cid = collectedEntity.Item as compositeid;
             List<string> setColumn = new List<string>();
             if (!string.IsNullOrEmpty(set.key.column1))
                 setColumn.Add(set.key.column1);
             if (null != set.key.column)
                 setColumn.AddRange(set.key.column.Select(q => q.name));
             List<string> collectedKeyColumns = new List<string>();
             collectedKeyColumns.AddRange(cid.Items.OfType<keyproperty>().Select(q => q.column1 ?? q.name));
             List<string> nonOverlappingColumns;
             if (CheckOverlapping(setColumn, collectedKeyColumns, out nonOverlappingColumns))
             {
                 setToRemove.Add(set);
                 entitiesToRemove.Add(collectedEntity.name);
                 map map = new map();
                 map.name = set.name;
                 map.table = set.table;
                 map.key = set.key;
                 var meta = context.GetTableMetaData(collectedEntity.schema, collectedEntity.table ?? collectedEntity.name);
                 if (nonOverlappingColumns.Count == 1)
                 {
                     map.Item = new index() { column1 = nonOverlappingColumns[0], type = typeConverter.GetNHType(meta.GetColumnMetadata(nonOverlappingColumns[0])) };
                 }
                 else
                 {
                     compositeindex ci = new compositeindex();
                     ci.@class = context.NamingStrategy.GetClassNameForComponentKey(map.name??map.table);
                     ci.Items = nonOverlappingColumns.Select(q => new keyproperty() {
                             name = context.NamingStrategy.GetPropertyNameFromColumnName(q)
                            ,column1 = context.NamingStrategy.GetPropertyNameFromColumnName(q) != q ? q : null
                            ,type1=typeConverter.GetNHType(meta.GetColumnMetadata(q))
                            ,length = meta.GetColumnMetadata(q).ColumnSize == 0 ? null:meta.GetColumnMetadata(q).ColumnSize.ToString()
                     }).ToArray();
                     map.Item = ci;
                 }
                 property[] props = collectedEntity.Items.OfType<property>().ToArray();
                 if (props.Length == 1)
                 {
                     //use an element
                     element e = new element();
                     e.column = props[0].column ?? props[0].name;
                     e.type1 = props[0].type1;
                     e.type = props[0].type;
                     e.precision = props[0].precision;
                     e.length = props[0].length;
                     map.Item1 = e;
                 }
                 else
                 {
                     //use a composite element
                     compositeelement ce = new compositeelement();
                     ce.@class = context.NamingStrategy.GetClassNameForCollectionComponent(collectedEntity.table??collectedEntity.name);
                     ce.Items = context.Model.GetPropertyOfEntity(collectedEntity.name);
                     map.Item1 = ce;
                 }
                 context.Model.AddCollectionToEntity(entity.name, map);
             }
         }
     }
 }
Ejemplo n.º 30
0
 // Use this for initialization
 void Start()
 {
     _camera = Camera.main;
     screenWidth = _camera.pixelWidth;
     screenHeight = _camera.pixelHeight;
     dmap= new map();
 }
Ejemplo n.º 31
0
    // Use this for initialization
    void Start()
    {
        //instatiating mainmenu.
        //GameObject startmenu = Instantiate(Resources.Load("ui/menuGO")) as GameObject;

        //instantiating environement
        env envi = new env();

        //instanciating map with it's parameters
        map map = new map("entrance", envi);
        //Debug.Log(map.mapname);

        //getting global map path
        string mapfilepath = map.getmappath(map.mapname);
        //Debug.Log(mapfilepath);

        //getting map full path
        map.mapfilepath = mapfilepath;
        //Debug.Log(map.mapfilepath);

        // checking if file exist
        if (map.mapfilepath == "error")
        {
            Debug.LogError("error occured opening map file");
        }
        else
        {
            //Debug.Log("path ok");

            string zonename;
            string[] mapparts = new string[100];
            //populating map.tempzone acording to image
            map.tempzone = tools.getcolor(map.mapfilepath);
            string textfile = map.getzonedeftxt(map.mapname);
            //grabing zone references
            mapparts = tools.getMapZones(textfile);
            map.zonemap = new List<List<Zone>>();
            List<Zone> row = new List<Zone>();

            //instanciating every zone + adding "border" zones (not interactive)
            for (int i = 0; i < (map.tempzone.Count) + 2; i++)
            {
                GameObject zonepos = Instantiate(Resources.Load("map/zonepointer")) as GameObject;
                zonepos.transform.position = new Vector3(((i * 16) - 16), 0, -16);
                Zone zone = new Zone("border", zonepos, map);
                row.Add(zone);
            }
            map.zonemap.Add(row);
            for (int i = 0; i < map.tempzone.Count; i++)
            {
                row = new List<Zone>();

                if (true)
                {
                    GameObject zonepos = Instantiate(Resources.Load("map/zonepointer")) as GameObject;
                    zonepos.transform.position = new Vector3(-16 , 0, i*16);
                    Zone zone = new Zone("border", zonepos, map);
                    row.Add(zone);
                }
                for (int j = 0; j < map.tempzone[i].Count; j++)
                {
                    //Debug.Log("instanciating zones");

                    GameObject zonepos = Instantiate(Resources.Load("map/zonepointer")) as GameObject;
                    zonepos.transform.position = new Vector3(j * 16, 0, i * 16);
                    if (map.tempzone[j][i].A == 255)
                    {
                        string tempcolor = tools.colortostring(map.tempzone[j][i]);
                        zonename = tools.getzonename(mapparts, tempcolor);
                        Zone zone = new Zone(zonename, zonepos, map);
                        row.Add(zone);
                    }
                    else
                    {
                        Zone zone = new Zone("empty", zonepos, map);
                        row.Add(zone);
                    }
                }
                if (true)
                {
                    GameObject zonepos = Instantiate(Resources.Load("map/zonepointer")) as GameObject;
                    zonepos.transform.position = new Vector3((map.tempzone.Count)*16, 0, i * 16);
                    Zone zone = new Zone("border", zonepos, map);
                    row.Add(zone);
                }
                map.zonemap.Add(row);
            }
            row = new List<Zone>();
            for (int o = 0; o < (map.tempzone.Count) + 2; o++)
            {
                GameObject zonepos = Instantiate(Resources.Load("map/zonepointer")) as GameObject;
                zonepos.transform.position = new Vector3(((o * 16) - 16), 0, (map.tempzone.Count * 16));
                Zone zone = new Zone("border", zonepos, map);
                row.Add(zone);
            }
            map.zonemap.Add(row);
        }

        //populating every zone Tiles
        //Debug.Log("populating empty tile");
        for (int i = 0; i < map.zonemap.Count; i++)
        {
            for (int j = 0; j < map.zonemap[i].Count; j++)
            {
                if (map.zonemap[j][i].type == "empty")
                {
                    for (int k = 0; k < 16; k++)
                    {
                        List<Tile> tilerow = new List<Tile>();
                        for (int l = 0; l < 16; l++)
                        {
                            GameObject tileholder = Instantiate(Resources.Load("tile/Tileholder")) as GameObject;
                            Renderer rnd = tileholder.GetComponent<Renderer>();
                            Tile tile = new Tile("empty", map.zonemap[j][i], tileholder, l, 0, k);
                            rnd.material = tileholder.GetComponent<Tileholder>().mats[0];
                            tileholder.GetComponent<Tileholder>().tile = tile;
                            tileholder.tag = "empty";
                            tile.worldpos = new Vector3((k+(16*j)),0,l+(16*i));
                            tilerow.Add(tile);
                        }
                        map.zonemap[j][i].tilemap.Add(tilerow);
                    }
                }
                else if (map.zonemap[j][i].type == "border")
                {
                    for (int k = 0; k < 16; k++)
                    {
                        List<Tile> tilerow = new List<Tile>();
                        for (int l = 0; l < 16; l++)
                        {
                            GameObject tileholder = Instantiate(Resources.Load("tile/Tileholder")) as GameObject;
                            Renderer rnd = tileholder.GetComponent<Renderer>();
                            Tile tile = new Tile("border", map.zonemap[j][i], tileholder, l, 0, k);
                            rnd.material = tileholder.GetComponent<Tileholder>().mats[0];
                            tileholder.GetComponent<Tileholder>().tile = tile;
                            tileholder.tag = "border";
                            tile.worldpos = new Vector3((k + (16 * j)), 0, l + (16 * i));
                            tilerow.Add(tile);
                        }
                        map.zonemap[j][i].tilemap.Add(tilerow);
                    }
                }
                else
                {
                    //Debug.Log("grabbing file directory");
                    string imagepath = map.zonemap[j][i].getzoneimagepath(map.mapsfilespath, map.zonemap[j][i].type, map.mapname);
                    //Debug.Log(imagepath);

                    //Debug.Log("grabbing tile color list");
                    List<List<System.Drawing.Color>> tilescolor = tools.getcolor(imagepath + map.zonemap[j][i].type + ".png");

                    //Debug.Log("grabbing zone tile definitions");
                    string[] tilref = tools.getMapZones(imagepath + "Tiles.txt");

                    for (int k = 0; k < 16; k++)
                    {
                        List<Tile> tilerow = new List<Tile>();
                        for (int l = 0; l < 16; l++)
                        {
                            GameObject tileholder = Instantiate(Resources.Load("tile/Tileholder")) as GameObject;
                            Renderer rnd = tileholder.GetComponent<Renderer>();

                            if (tilescolor[l][k].A == 255)
                            {
                                string tilemame = tools.getzonename(tilref, tools.colortostring(tilescolor[l][k]));
                                if (tilemame == "openfloorTile")
                                {
                                    Tile tile = new Tile("openfloorTile", map.zonemap[j][i], tileholder, l, -1, k);
                                    rnd.material = tileholder.GetComponent<Tileholder>().mats[2];
                                    tileholder.GetComponent<Tileholder>().tile = tile;
                                    tileholder.tag = "floor";
                                    tile.worldpos = new Vector3((k + (16 * j)), 0, l + (16 * i));
                                    tilerow.Add(tile);
                                }
                                else if (tilemame == "wallTile")
                                {
                                    Tile tile = new Tile("wallTile", map.zonemap[j][i], tileholder, l, 0, k);
                                    rnd.material = tileholder.GetComponent<Tileholder>().mats[2];
                                    tileholder.GetComponent<Tileholder>().tile = tile;
                                    tileholder.tag = "wall";
                                    tile.worldpos = new Vector3((k + (16 * j)), 0, l + (16 * i));
                                    tilerow.Add(tile);

                                }
                                else if (tilemame == "collumn")
                                {
                                    Tile tile = new Tile("collumn", map.zonemap[j][i], tileholder, l, 0, k);
                                    rnd.material = tileholder.GetComponent<Tileholder>().mats[2];
                                    tileholder.GetComponent<Tileholder>().tile = tile;
                                    tileholder.tag = "wall";
                                    tile.worldpos = new Vector3((k + (16 * j)), 0, l + (16 * i));
                                    tilerow.Add(tile);
                                }
                            }
                            else
                            {
                                Tile tile = new Tile("empty", map.zonemap[j][i], tileholder, l, 0, k);
                                rnd.material = tileholder.GetComponent<Tileholder>().mats[0];
                                tileholder.GetComponent<Tileholder>().tile = tile;
                                tileholder.tag = "empty";
                                tile.worldpos = new Vector3((k + (16 * j)), 0, l + (16 * i));
                                tilerow.Add(tile);
                            }
                        }
                        map.zonemap[j][i].tilemap.Add(tilerow);

                    }
                }
            }
        }
        //generating map global tilemap
        map.generatemaptilemap();
        //updating tiles according to surounding
        map.tileCheckForEmptyToWall();
    }
Ejemplo n.º 32
0
Archivo: game.cs Proyecto: hoki444/2014
 // Use this for initialization
 void Start()
 {
     _camera = Camera.main;
     screenWidth = _camera.pixelWidth;
     screenHeight = _camera.pixelHeight;
     enemies = new enemy[20];
     enemynumber = 0;
     nowenemy = 0;
     mines = new mine[1000];
     minenumber = 0;
     nowmine = 0;
     dmap = new map ();
     StreamReader sr= new StreamReader("playinfo.txt");
     mode = sr.ReadLine();
     stage = int.Parse(sr.ReadLine());
     sr.Close();
     sr = new StreamReader(mode+"map\\"+stage.ToString()+".txt");
     string nextstring="";
     char[] cstring= new char[100];
     for (int y=0; y<15; y++) {
         nextstring=sr.ReadLine();
         cstring=nextstring.ToCharArray();
         for (int x=0; x<15; x++) {
             dmap.mapparts [y, x]=int.Parse(cstring[x].ToString());
         }
     }
     nextstring=sr.ReadLine();
     cstring=nextstring.ToCharArray();
     for (int x=0; x<5; x++) {
         dmap.mine[x]=int.Parse(cstring[2*x].ToString())*10+int.Parse(cstring[2*x+1].ToString());
     }
     nextstring=sr.ReadLine();
     cstring=nextstring.ToCharArray();
     for (int x=0; x<5; x++) {
         if(cstring[x]=='0')
             dmap.enemy[x]=false;
         else
             dmap.enemy[x]=true;
     }
     dmap.playerx=int.Parse(sr.ReadLine());
     dmap.playery=int.Parse(sr.ReadLine());
     sr.Close();
     for (int y=0; y<15; y++) {
         for (int x=0; x<15; x++) {
             Vector3 nextpoint= new Vector3((float)(-3+0.668*x),(float)(4.67-0.668*y));
             Instantiate (maps [dmap.mapparts[y,x]], nextpoint, transform.rotation);
         }
     }
     player = GameObject.Find ("character").GetComponent<character>();
     player.positionx = dmap.playerx;
     player.positiony = dmap.playery;
     turn = dmap.turn;
 }
Ejemplo n.º 33
0
Archivo: mine.cs Proyecto: hoki444/2014
 // Use this for initialization
 void Start()
 {
     state = "mine";
     dmap = GameObject.Find ("Main Camera").GetComponent<game> ().dmap;
 }
Ejemplo n.º 34
0
 public Attributes(map <@string, Attribute> AttributeMap = default, int DroppedAttributesCount = default)
 {
     this.AttributeMap           = AttributeMap;
     this.DroppedAttributesCount = DroppedAttributesCount;
 }
 assertTrue(map.isEmpty());
 public verifierMap(map <nameHash, slice <Verifier> > value) => m_value = value;
Ejemplo n.º 37
0
        public bool Hit(map.Chip chip, PointD pointInView, int chipWidth, int chipHeight)
        {
            if (_isPaused) return false;
            if (_isInvincible) return false; // 無敵中

            foreach (Point cp in _collisionPoints)
            {
                double cpx = pointInView.X + cp.X; double cpy = pointInView.Y + cp.Y;
                bool collision =
                    (chip.ViewX <= cpx && chip.ViewY <= cpy &&
                    cpx <= chip.ViewX + chipWidth && cpy <= chip.ViewY + chipHeight);
                if (collision)
                {
                    Hp -= chip.Hardness;

                    // 爆発開始
                    _isExplosion = true;
                    _explosionStartTick = Environment.TickCount;
                    _ptclEmitter.Emitting = false;
                    _ptclEmitter.X = (float)cpx; _ptclEmitter.Y = (float)cpy;
                    _ptclEmitter.Emitting = true;
                    
                    // 無敵時間開始
                    _isInvincible = true;
                    _invincibleStartTick = Environment.TickCount;

                    return true;
                }
            }
            return false;
        }
Ejemplo n.º 38
0
 public Part(textproto.MIMEHeader Header = default, ref ptr <Reader> mr = default, @string disposition = default, map <@string, @string> dispositionParams = default, io.Reader r = default, long n = default, long total = default, error err = default, error readErr = default)
 {
     this.Header            = Header;
     this.mr                = mr;
     this.disposition       = disposition;
     this.dispositionParams = dispositionParams;
     this.r       = r;
     this.n       = n;
     this.total   = total;
     this.err     = err;
     this.readErr = readErr;
 }
Ejemplo n.º 39
0
        public SceneGameStage(map.Map map)
        {
            sceneType = SceneType.GameStage;
            _map = map;

            #region メニューアイテム
            _clearMenuItems = new MenuItem[]
            {
                new MenuItem(Key.M, Properties.Resources.MenuItem_MapSelect),
                new MenuItem(Key.T, Properties.Resources.MenuItem_ReturnTitle)
            };
            #endregion

            _keys = new Key[]
            {
                Key.UpArrow, Key.DownArrow, Key.Return,
                Key.Escape, Key.R, Key.M, Key.T
            };

            // 画像読み込み
            _lifeSurfaces = ResourceManager.LoadSurfaces(Constants.Filename_LifeImage, new Size(30, 32));

            #region 配置
            _viewRect = new Rectangle(
                Constants.ScreenWidth - Constants.StageViewWidth - Constants.StageMargin,
                Constants.StageMargin,
                Constants.StageViewWidth,
                Constants.StageViewHeight);
            _keyRect = new Rectangle(
                Constants.StageMargin,
                Constants.StageMargin,
                _viewRect.Left - 1 - Constants.StageMargin,
                Constants.StageViewHeight);
            _miniMapRect = new Rectangle(
                Constants.ScreenWidth - Constants.MiniMapWidth - Constants.StageMargin,
                _viewRect.Bottom + Constants.StageGap,
                Constants.MiniMapWidth,
                Constants.ScreenHeight - Constants.StageMargin - _viewRect.Bottom - Constants.StageGap);
            _playerInfoRect = new Rectangle(
                Constants.StageMargin,
                _viewRect.Bottom + Constants.StageGap,
                _miniMapRect.Left - Constants.StageMargin - Constants.StageGap,
                _miniMapRect.Height);
            #endregion

            #region PID制御係数決定
            _prevYDiff = 0;
            _yDiff = 0;
            _coefP = 0.5;
            _coefI = _coefP * 0.4;
            _coefD = _coefP * 0.01;
            _diffT = 1 / (double)SdlDotNet.Core.Events.TargetFps;
            #endregion
        }
Ejemplo n.º 40
0
 public loader(map <@string, bool> tags = default, bool testRoots = default, bool isALL = default, bool testAll = default, bool forceStdVendor = default, slice <ptr <loadPkg> > roots = default, slice <ptr <loadPkg> > pkgs = default, ref ptr <par.Work> work = default, ref ptr <par.Cache> pkgCache = default, map <@string, bool> direct = default, map <@string, @string> goVersion = default)
 {
     this.tags           = tags;
     this.testRoots      = testRoots;
     this.isALL          = isALL;
     this.testAll        = testAll;
     this.forceStdVendor = forceStdVendor;
     this.roots          = roots;
     this.pkgs           = pkgs;
     this.work           = work;
     this.pkgCache       = pkgCache;
     this.direct         = direct;
     this.goVersion      = goVersion;
 }
Ejemplo n.º 41
0
        public void Update(GameTime gameTime, map.tile.TileMap myMap)
        {
            Vector2 moveVector = Vector2.Zero;
            Vector2 moveDir = Vector2.Zero;
            string animation = "";

            if (managers.InputManager.Instance.KeyDown(Keys.W) && managers.InputManager.Instance.KeyDown(Keys.A))
            {
                moveDir = new Vector2(-2, -1);
                animation = "WalkNorthWest";
                moveVector += new Vector2(-2, -1);
            }
            else if (managers.InputManager.Instance.KeyDown(Keys.W) && managers.InputManager.Instance.KeyDown(Keys.D))
            {
                moveDir = new Vector2(2, -1);
                animation = "WalkNorthEast";
                moveVector += new Vector2(2, -1);
            }
            else if (managers.InputManager.Instance.KeyDown(Keys.D) && managers.InputManager.Instance.KeyDown(Keys.S))
            {
                moveDir = new Vector2(2, 1);
                animation = "WalkSouthEast";
                moveVector += new Vector2(2, 1);
            }
            else if (managers.InputManager.Instance.KeyDown(Keys.S) && managers.InputManager.Instance.KeyDown(Keys.A))
            {
                moveDir = new Vector2(-2, 1);
                animation = "WalkSouthWest";
                moveVector += new Vector2(-2, 1);
            }
            else if (managers.InputManager.Instance.KeyDown(Keys.W))
            {
                moveDir = new Vector2(0, -1);
                animation = "WalkNorth";
                moveVector += new Vector2(0, -1);
            }
            else if (managers.InputManager.Instance.KeyDown(Keys.D))
            {
                moveDir = new Vector2(2, 0);
                animation = "WalkEast";
                moveVector += new Vector2(2, 0);
            }
            else if (managers.InputManager.Instance.KeyDown(Keys.S))
            {
                moveDir = new Vector2(0, 1);
                animation = "WalkSouth";
                moveVector += new Vector2(0, 1);
            }
            else if (managers.InputManager.Instance.KeyDown(Keys.A))
            {
                moveDir = new Vector2(-2, 0);
                animation = "WalkWest";
                moveVector += new Vector2(-2, 0);
            }

            if (myMap.GetCellAtWorldPoint(vlad.Position + moveDir).Walkable == false)
            {
                moveDir = Vector2.Zero;
            }

            if (Math.Abs(myMap.GetOverallHeight(vlad.Position) - myMap.GetOverallHeight(vlad.Position + moveDir)) > 10)
            {
                moveDir = Vector2.Zero;
            }

            if (moveDir.Length() != 0)
            {
                vlad.MoveBy((int)moveDir.X, (int)moveDir.Y);
                if (vlad.CurrentAnimation != animation)
                    vlad.CurrentAnimation = animation;
            }
            else
            {
                vlad.CurrentAnimation = "Idle" + vlad.CurrentAnimation.Substring(4);
            }

            float vladX = MathHelper.Clamp(
                vlad.Position.X, 64 + vlad.DrawOffset.X, Camera.Instance.WorldWidth);
            float vladY = MathHelper.Clamp(
                vlad.Position.Y, 132 + vlad.DrawOffset.Y, Camera.Instance.WorldHeight);

            vlad.Position = new Vector2(vladX, vladY);

            Vector2 testPosition = Camera.Instance.WorldToScreen(vlad.Position);

            if (testPosition.X < 100)
            {
                Camera.Instance.Move(new Vector2(testPosition.X - 100, 0));
            }

            if (testPosition.X > (Camera.Instance.ViewWidth - 100))
            {
                Camera.Instance.Move(new Vector2(testPosition.X - (Camera.Instance.ViewWidth - 100), 0));
            }

            if (testPosition.Y < 100)
            {
                Camera.Instance.Move(new Vector2(0, testPosition.Y - 100));
            }

            if (testPosition.Y > (Camera.Instance.ViewHeight - 100))
            {
                Camera.Instance.Move(new Vector2(0, testPosition.Y - (Camera.Instance.ViewHeight - 100)));
            }

            vlad.Update(gameTime);
        }