Пример #1
0
        public TypeResult GetData(TypeObject _object, TypeAction _action)
        {
            DataForObject  _data       = dataForObjects.Find(x => x.typeObject == _object);
            DataWithAction _dataAction = _data.withActions.Find(x => x.typeAction == _action);

            return(_dataAction.typeResult);
        }
Пример #2
0
        private void bt_Pyramid_Click(object sender, EventArgs e)
        {
            currentType = TypeObject.SQUARE_PYRAMID;
            if (isTexture == true)
            {
                drObj.addObj(currentType, currentColor, isTexture, textureLink); // Them object vao list luu tru
                isTexture   = false;
                textureLink = "";
            }
            else
            {
                drObj.addObj(currentType, currentColor);                // Them object vao list luu tru
            }
            int count = listObjName.Count();                            // Lay so phan tu hien tai

            listObjName.Add("Pyramid " + "(" + count.ToString() + ")"); // Them vao list quan ly
            listPos.Add(new Point3D());                                 // Them toa position cho obj nay
            listRota.Add(new Point3D());                                // Them toa do rotation cho obj nay
            listScale.Add(new Point3D(1, 1, 1));                        // Them toa do scale cho obj nay
            lstBox_SampleScene.Items.Add(listObjName[count]);           // Them item va in ra list box

            lstBox_SampleScene.SelectedIndex = count;                   // In dam obj duoc ve tren listbox
            indexCurrentObj = count;                                    // Luu index cua Obj vua moi ve
            isDrawing       = true;                                     // Cap nhat de ve
        }
Пример #3
0
        public TypeObject GetTypeObject(ClassToken token)
        {
            TypeObject result = null;

            _typeObjects.TryGetValue(token, out result);
            return(result);
        }
Пример #4
0
        public void Execute(MethodContext context, MethodState state, object operand = null)
        {
            //Check ctor token validity
            var ctorTkn = (operand as MethodToken);

            if (ctorTkn == null)
            {
                throw new InvalidOperationException("Invalid constructor token");
            }

            //Check if object type is loaded into domain
            if (!context.TypeLoader.TypeIsLoaded(ctorTkn.Owner))
            {
                throw new InvalidOperationException("Type is not loaded into the domain");
            }
            TypeObject typeObj = context.TypesHeap.GetTypeObject(ctorTkn.Owner);

            //Allocate an object in heap
            var objRef = context.GCHeap.AllocObjRetAddr(typeObj);

            //Put 'this' to the evaluation stack
            ESSlot thisSlot = new ESSlot()
            {
                TypeToken = typeObj.Token,
                SType     = ESSlotType.HORef,
                Val       = objRef
            };

            context.EvalStack.Push(thisSlot);

            //Initiate ctor call
            state.CallMethod            = typeObj.VTable.GetMethod(ctorTkn);
            state.ExecutionInterruption = ExecutionInterruption.Call;
        }
Пример #5
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (blastRadius == 0)
        {
            TypeObject typeObject = collision.GetComponent <TypeObject>();

            if (typeObject && typeObject.obj == Obj.terrain)
            {
                Destroy(gameObject);
            }
            else
            {
                Unit unit = collision.GetComponent <Unit>();

                //  if (unit && unit.gameObject != parent && unit.enemy != enemy)
                if (unit && unit.gameObject && unit.enemy != enemy)
                {
                    unit.ReceiveDamage();
                    Destroy(gameObject);
                }
            }
        }
        else
        {
            CircleCollider2D circleCollider2D = GetComponent <CircleCollider2D>();
            circleCollider2D.radius = blastRadius;
            blastRadius             = 0;
        }
    }
Пример #6
0
        public void SetData(TypeObject _object, TypeAction _action, TypeResult _result)
        {
            DataForObject  _data       = dataForObjects.Find(x => x.typeObject == _object);
            DataWithAction _dataAction = _data.withActions.Find(x => x.typeAction == _action);

            _dataAction.typeResult = _result;
        }
Пример #7
0
        public void ValueTypes()
        {
            var args = new string[] {
                "--string-value", $"{v1}",
                "--char-value", $"{v2}",
                "--integer-value", $"{v3}",
                "--long-value", $"{v4}",
                "--boolean-value", "true",
                "--float-value", $"{v5}",
                "--double-value", $"{v6}",
                "--decimal-value", $"{v7}"
            };

            var obj = new TypeObject();

            Magnet.Attract(obj, args);

            Assert.Equal(v1, obj.StringValue);
            Assert.Equal(v2, obj.CharValue);
            Assert.Equal(v3, obj.IntegerValue);
            Assert.Equal(v4, obj.LongValue);
            Assert.True(obj.BooleanValue);
            Assert.Equal(v5, obj.FloatValue);
            Assert.Equal(v6, obj.DoubleValue);
            Assert.Equal(v7, obj.DecimalValue);
        }
Пример #8
0
    private async Task Receive()
    {
        if (ativo)
        {
            var buffer = new ArraySegment <byte> (new byte[1024]);
            while (true)
            {
                WebSocketReceiveResult result = await this.webSocket.ReceiveAsync(buffer, CancellationToken.None);

                switch (result.MessageType)
                {
                case WebSocketMessageType.Close:
                    return;

                case WebSocketMessageType.Text:
                case WebSocketMessageType.Binary:
                    string     json = Encoding.UTF8.GetString(buffer.Array, 0, result.Count);
                    var        obj  = Newtonsoft.Json.Linq.JObject.Parse(json);
                    TypeObject man  = new TypeObject(this.man, (string)obj["type"], (string)obj["asset"], (float)obj["x"], (float)obj["y"], (bool)obj["fuiEu"]);
                    man.Run();
                    break;
                }
            }
        }
    }
Пример #9
0
        public virtual void WriteToFile(BinaryWriter writer)
        {
            PopulateStringTable();

            // Begin to write FaceFX header
            writer.Write(FaceMagic);
            writer.Write(SDKVersion);
            writer.Write(0);
            StringHelpers.WriteString32(writer, LicenseeName);
            StringHelpers.WriteString32(writer, LicenseeProjectName);
            writer.Write(Unk0);
            writer.Write(Unk1);

            // Write OC3 types
            writer.Write(SerializedTypes.Length);
            foreach (var TypeObject in SerializedTypes)
            {
                TypeObject.WriteToFile(writer);
            }

            // Write StringTable
            writer.Write(StringTable.Length);
            foreach (var Name in StringTable)
            {
                StringHelpers.WriteString32(writer, Name);
            }

            ObjectData.Serialize(this, writer);
        }
Пример #10
0
 public FResume()
 {
     InitializeComponent();
     cbAction.DataSource = SqlAction.List();
     cbWhat.DataSource   = TypeObject.List();
     EnableButtons();
 }
Пример #11
0
        public void Execute(MethodContext context, MethodState state, object operand = null)
        {
            MethodToken methodDef = (operand as MethodToken);

            if (methodDef == null)
            {
                throw new ArgumentException("Incorrect or null method definition");
            }
            MethodDesc method = null;

            if (methodDef.Owner != null)
            {
                TypeObject owner = context.TypesHeap.GetTypeObject(methodDef.Owner);
                method = owner.VTable.GetMethod(methodDef);
            }
            else
            {
                method = context.TypesHeap.GetGlobalMethod(methodDef);
            }

            if (method == null)
            {
                throw new InvalidOperationException("Method described by the provided metadata was not found in type's vtable");
            }

            state.CallMethod            = method;
            state.ExecutionInterruption = ExecutionInterruption.Call;
        }
Пример #12
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="image">Image object</param>
 /// <param name="type">Type object</param>
 protected ObjectGame(Image image, TypeObject type)
 {
     Image = image;
     Position = new PointF(0, 0);
     Direction = 0;
     Type = type;
     Radius = 0.5f * Image.Width;
 }
Пример #13
0
 public void DecreaseObjectAmount(TypeObject typeObject)
 {
     switch (typeObject)
     {
     case TypeObject.BeerCan:
         nbOfCan--;
         break;
     }
 }
Пример #14
0
 public void Config(Action action, TypeObject type, Sprite sprite = null)
 {
     this.action = action;
     this.type   = type;
     if (sprite != null)
     {
         GetComponent <Image>().sprite = sprite;
     }
 }
Пример #15
0
        private void FillTypeObject()
        {
            lstTypeObject.Items.Clear();
            foreach (var typObj in TypeObject.List().Where(x => x.TypeObjectId > 0).OrderBy(x => x.TypeObjectPrestentOrder))
            {
                lstTypeObject.Items.Add(typObj);
            }

            ChangeAllCecks(true);
        }
Пример #16
0
 public void ShowMensagem(TypeObject tp)
 {
     if (tp.type == "ganhei" && tp.fuiEu == false)
     {
         Debug.Log("Perdi :(");
         Instantiate(perdeu, new Vector3(camera.transform.position.x,
                                         camera.transform.position.y, 0), transform.rotation);
         player.pause = true;
     }
 }
Пример #17
0
    public TypeObject Choose()
    {
        TypeObject typeObject = 0;
        int        randValue  = Random.Range(0, maxProbability);

        while (lootProbabilities [(int)typeObject] <= randValue)
        {
            typeObject++;
        }
        return(typeObject);
    }
Пример #18
0
    protected override void OnTriggerEnter2D(Collider2D collision)
    {
        base.OnTriggerEnter2D(collision);

        TypeObject typeObject = collision.GetComponent <TypeObject>();

        if (typeObject && typeObject.obj == Obj.terrain)
        {
            Turn();
        }
    }
Пример #19
0
 public static bool IsWall(TypeObject item)
 {
     if (item == TypeObject.WALL)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #20
0
    public async Task Send(string type, string asset, float x, float y)
    {
        if (ativo)
        {
            var json   = new TypeObject(this.man, type, asset, x, y, false).ToJson();
            var buffer = new ArraySegment <byte> (Encoding.UTF8.GetBytes(json));
            await this.webSocket.SendAsync(buffer, WebSocketMessageType.Text, true, CancellationToken.None);

            return;
        }
    }
Пример #21
0
 public static bool IsFood(TypeObject item)
 {
     if (item == TypeObject.FOOD_APPLE)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #22
0
 public static bool IsEnemy(TypeObject item)
 {
     if (item == TypeObject.ENEMY_VERT)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #23
0
        public void Initialization(TypeObject type)
        {
            typeObject  = type;
            withActions = new List <DataWithAction>();
            TypeAction temp;

            for (int i = 0; i < Enum.GetNames(typeof(TypeAction)).Length; i++)
            {
                temp = (TypeAction)i;
                withActions.Add(new DataWithAction(temp));
            }
        }
Пример #24
0
        public void MoveTo(TypeObject[,] map, int newX, int newY)
        {
            TypeObject old = map[_y, _x];

            map[_y, _x] = TypeObject.NONE;
            //_canvas.DrawItem(_x, _y, map);

            _x = newX;
            _y = newY;

            map[_y, _x] = old;
            //  _canvas.DrawItem(_x, _y, map);
        }
Пример #25
0
    public void DestroiObject(TypeObject tp)
    {
        GameObject[] allObjects = GameObject.FindGameObjectsWithTag(tp.asset);

        foreach (GameObject go in allObjects)
        {
            if ((int)go.transform.position.x == (int)tp.x && (int)go.transform.position.y == (int)tp.y)
            {
                Destroy(go);
                return;
            }
        }
    }
Пример #26
0
        public GCHeapObj AllocObj(TypeObject typeObject)
        {
            GCHeapObj heapObj = new GCHeapObj()
            {
                Addr      = _nxtfreeSlt,
                TypeToken = typeObject.Token,
                Val       = null
            };

            _htable.Add(_nxtfreeSlt, heapObj);
            Interlocked.Increment(ref _nxtfreeSlt);
            return(heapObj);
        }
    public GameObject GetObject(TypeObject typeObject)
    {
        switch (typeObject)
        {
        case TypeObject.CRATE:
            return(brokenCratePrefab);

        case TypeObject.BOTTLE:
            return(brokenBottlePrefab);

        default:
            return(null);
        }
    }
Пример #28
0
 /// <summary>
 /// 型情報を解析し、シリアライズの初期化をします。
 /// </summary>
 public BinaryContractSerializer()
 {
     TypeObject = typeof(T);
     if (TypeObject.GetCustomAttribute <BinaryContractAttribute>() == null)
     {
         throw new NotSupportedException("BinaryContract属性が指定されていない型です : " + TypeObject.Name);
     }
     AllowedFields = TypeObject.GetFields()
                     .Where((p) => p.GetCustomAttribute <BinaryContractMemberAttribute>() != null)
                     .ToList();
     AllowedProperties = TypeObject.GetProperties()
                         .Where((p) => p.GetCustomAttribute <BinaryContractMemberAttribute>() != null)
                         .ToList();
 }
Пример #29
0
    public void InstanceObject(TypeObject tp)
    {
        switch (tp.asset)
        {
        case "tijolo":
            var objCreated = Instantiate(this.tijolo, new Vector3(tp.x, tp.y, 0f), Quaternion.identity);
            // Add objeCreated in Hash Table
            break;

        default:
            Debug.Log("Não implementado");
            break;
        }
    }
Пример #30
0
        public ObjectGame( string source, TypeObject Type)
        {
            this.Image = new Image();
            Uri url = new Uri(source,UriKind.Relative);
            BitmapImage bmp = new BitmapImage(url);
            this.Image.Source = bmp;
            Image.Width = 0;
            Image.Height = 0;
            Image.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            Image.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            Image.Visibility = System.Windows.Visibility.Visible;

            this.Image.Margin = new Thickness(-10, -10, -10, -10);
            this.Type = Type;
        }
Пример #31
0
    public void SetIndex(int index)
    {
        if (index >= _spawnables.Count)
        {
            return;
        }
        _currentSpawnable = _spawnables[index];
        float damages = 0;

        foreach (TypeAmmo ammo in _currentSpawnable.weapons)
        {
            damages += ammo.damage;
        }
        UIScript.Instance.SetSprite(_currentSpawnable.sprite, damages, _currentSpawnable.speedFire, _currentSpawnable.value);
    }
Пример #32
0
        public Form1()
        {
            InitializeComponent();

            fullFileName = Path.Combine(Application.StartupPath, "Jeux2Test.Json");

            datas    = RegexFoundingUnitTest.Load(fullFileName).ToList();
            isChange = false;

            lblNo.Visible       = false;
            cbAction.DataSource = SqlAction.List().Where(x => x.SqlActionId > 1).ToList();
            cbWhat.DataSource   = TypeObject.List().Where(x => x.TypeObjectId >= 0).ToList();
            lblInfos.Text       = string.Empty;
            Choix_SelectedIndexChanged(null, null);
            GereBoutton();
        }
Пример #33
0
 public TypeObject CopyFrom(TypeObject other)
 {
     throw new NotImplementedException();
 }
Пример #34
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="image">Image object</param>
 /// <param name="type">Type object</param>
 protected Wall(Image image, TypeObject type)
     : base(image, type)
 {
 }
Пример #35
0
        private void loadGameObject(string path,int tag,TypeObject typeObject)
        {
            ToolTip tooltip = new ToolTip();
            tooltip.AutoPopDelay = 5000;
            tooltip.InitialDelay = 100;
            tooltip.ReshowDelay = 500;

            Image img = new Bitmap(path);

            PictureBox tile = new PictureBox();
            tile.BackColor = Color.Transparent;
            tile.SizeMode = PictureBoxSizeMode.AutoSize;
            tile.Tag = tag;
            tile.Image = img;
            tile.Click += Tile_Click;
            tooltip.SetToolTip(tile, "Tag: " + (int)tile.Tag);

            _listPathObject.Add(new Tuple<int, string>((int)tile.Tag, path));

            if (typeObject==TypeObject.Static)
            {
                flowLayoutPanel1.Controls.Add(tile);
            }
            else
            {
                flowLayoutPanel2.Controls.Add(tile);
            }
        }
Пример #36
0
 public StaticObject(string url, TypeObject Type)
     : base(url, Type)
 {
 }
        public void Can_parse_dynamic_json()
        {
            var json = @"{
              ""prop1"": ""text string"",
              ""prop2"": 33,
              ""prop3"": true,
              ""prop4"": 6.3,
              ""prop5"": [ ""A"", ""B"", ""C"" ],
              ""prop6"": { ""A"" : ""a"" }
            }";

            var typeObj = json.FromJson<TypeObject>();

            Assert.That(typeObj.Prop1, Is.EqualTo("text string"));
            Assert.That(typeObj.Prop2, Is.EqualTo(33));
            Assert.That(typeObj.Prop3, Is.EqualTo(true));
            Assert.That(typeObj.Prop4, Is.EqualTo(6.3d));
            Assert.That(typeObj.Prop5, Is.EquivalentTo(new[] { "A", "B", "C" }));
            Assert.That(typeObj.Prop6, Is.EquivalentTo(new Dictionary<string, string> { { "A", "a" } }));

            var obj = JsonObject.Parse(json);

            var o = new TypeObject
            {
                Prop1 = obj["prop1"],
                Prop2 = obj.Get<int>("prop2"),
                Prop3 = obj.Get<bool>("prop3"),
                Prop4 = obj.Get<double>("prop4"),
                Prop5 = obj.Get<string[]>("prop5"),
                Prop6 = obj.Object("prop6"),
            };

            Assert.That(o.Prop1, Is.EqualTo("text string"));
            Assert.That(o.Prop2, Is.EqualTo(33));
            Assert.That(o.Prop3, Is.EqualTo(true));
            Assert.That(o.Prop4, Is.EqualTo(6.3d));
            Assert.That(o.Prop5, Is.EquivalentTo(new[] { "A", "B", "C" }));
            Assert.That(o.Prop6, Is.EquivalentTo(new Dictionary<string, string> { { "A", "a" } }));
        }
Пример #38
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="image">Image object</param>
 /// <param name="type">Type object</param>
 protected Bullet(Image image, TypeObject type)
     : base(image, type)
 {
 }
Пример #39
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="image">Image object</param>
 /// <param name="type">Type object</param>
 protected AnimationObject(Image image, TypeObject type)
     : base(image, type)
 {
 }
Пример #40
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="image">Image object</param>
 /// <param name="type">Type object</param>
 protected Tank(Image image, TypeObject type)
     : base(image, type)
 {
 }
Пример #41
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="image">Image object</param>
 /// <param name="type">Type object</param>
 protected DynamicObject(Image image, TypeObject type)
     : base(image, type)
 {
 }
Пример #42
0
 public AnimationObject(string url, TypeObject Type)
     : base(url, Type)
 {
 }
Пример #43
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="image">Image object</param>
 /// <param name="type">Type object</param>
 protected StaticObject(Image image, TypeObject type)
     : base(image, type)
 {
 }
Пример #44
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="image">Image object</param>
 /// <param name="type">Type object</param>
 protected Background(Image image, TypeObject type)
     : base(image, type)
 {
 }
Пример #45
0
 public DynamicObject(string url, TypeObject Type)
     : base(url, Type)
 {
     this.Direction = 0;
 }