コード例 #1
0
        public void InsertObject(CNode node, OBJECT obj)
        {
            RECTANGLE rect = RECTANGLE.Intersec(node.m_bound, obj.RangeOfMovement);

            if (rect.cX == 0 && rect.cY == 0 && rect.width == 0 && rect.height == 0)
            {
                return;
            }

            if (node.m_bound.width >= (MAX_HEIGHT_SIZE_OF_NODE + 10) && node.m_bound.height > (MAX_HEIGHT_SIZE_OF_NODE + 10))
            {
                if (node.m_tl == null)
                {
                    node.m_tl = new CNode(node.m_id, PositionOfNode.TopLeft, node.Bound);
                    node.m_tr = new CNode(node.m_id, PositionOfNode.TopRight, node.Bound);
                    node.m_bl = new CNode(node.m_id, PositionOfNode.BottomLeft, node.Bound);
                    node.m_br = new CNode(node.m_id, PositionOfNode.BottomRight, node.Bound);
                }

                node.InsertObject(node.m_tl, obj);
                node.InsertObject(node.m_tr, obj);
                node.InsertObject(node.m_bl, obj);
                node.InsertObject(node.m_br, obj);
            }
            else
            {
                node.m_listObject.Add(obj);
            }

            return;
        }
コード例 #2
0
    public bool SetObject(OBJECT obj)
    {
        if (!_initialized)
        {
            return(false);
        }

        npoEntity = PeScenarioUtility.GetEntity(obj);

        if (npoEntity != null)
        {
            npoId = obj.Id;

            if (npoEntity == CreatureMgr.Instance.mainPlayer)
            {
                BiologyViewCmpt viewCmpt = npoEntity.biologyViewCmpt;
                Texture2D       big_head = PeViewStudio.TakePhoto(viewCmpt, 150, 150, PeViewStudio.s_HeadPhotoPos, PeViewStudio.s_HeadPhotoRot);
                npcSpeechBox.SetNpcInfo(npoEntity.ExtGetName(), big_head);
            }
            else
            {
                npcSpeechBox.SetNpcInfo(npoEntity.ExtGetName(), npoEntity.ExtGetFaceIconBig());
            }

            return(true);
        }
        else
        {
            npoId = -1;
            npcSpeechBox.SetNpcInfo("", "Null");
        }

        return(false);
    }
コード例 #3
0
    //---------------------------------------------------

    //GameObjectを消す処理--------------------------------
    public void ActiveDestroy(OBJECT obj)
    {
        if (( int )obj > _object.Length - 1)
        {
            return;
        }
        Destroy(_object[( int )obj]);
    }
コード例 #4
0
    //---------------------------------------------------

    //GameObjectのActive状態を調べる処理--------------------
    public bool SearchActive(OBJECT obj)
    {
        if (( int )obj > _object.Length - 1)
        {
            return(false);
        }
        return(_object[( int )obj].activeInHierarchy);
    }
コード例 #5
0
ファイル: SerializedData.cs プロジェクト: huai707/Mahjong
 protected void pushParam(OBJECT param)
 {
     if (param == null)
     {
         logError("param is null!");
     }
     mParameterInfoList.Add(param);
 }
コード例 #6
0
 //GameObjectのActiveを切り替える処理--------------------
 public void Active(OBJECT obj, bool active)
 {
     if (( int )obj > _object.Length - 1)
     {
         return;
     }
     _object[( int )obj].SetActive(active);
 }
コード例 #7
0
 protected void pushParam(OBJECT param, bool variableLength = false)
 {
     if (param == null)
     {
         logError("param is null!");
         return;
     }
     param.setVariableLength(variableLength);
     mParameterInfoList.Add(param);
 }
コード例 #8
0
        public static VECTOR2D ConvertCoordination(OBJECT _object)
        {
            VECTOR2D temp = new VECTOR2D(_object.Position.cX, _object.Position.cY);

            temp.cY = (int)(Support.HEIGHT_MAP - _object.Position.cY);
            temp.cX = (int)(temp.cX + _object.Bound.width / 2);
            temp.cY = (int)(temp.cY - _object.Bound.height / 2);

            return(temp);
        }
コード例 #9
0
        public void SaveMap()
        {
            if (Support.listObject != null && Support.IsExportXml == false)
            {
                for (int i = 0; i < WorkspaceWorking.Children.Count; ++i)
                {
                    if (WorkspaceWorking.Children[i] is Image)
                    {
                        Image tempRect = (Image)WorkspaceWorking.Children[i];
                        if ((int)tempRect.Tag != (int)ObjectType.TILE_MAP)
                        {
                            ++Support.Count;
                            OBJECT   temp         = new OBJECT((int)ObjectType.NORMAL_OBJECT, (int)tempRect.Tag, Support.Count, new VECTOR2D((float)Canvas.GetLeft(WorkspaceWorking.Children[i]), (float)Canvas.GetTop(WorkspaceWorking.Children[i])), new RECTANGLE((float)Canvas.GetLeft(WorkspaceWorking.Children[i]), (float)Canvas.GetTop(WorkspaceWorking.Children[i]), (int)tempRect.Width, (int)tempRect.Height));
                            VECTOR2D tempPosition = Support.ConvertCoordination(temp);
                            Support.listObject.Add(new OBJECT((int)ObjectType.NORMAL_OBJECT, (int)tempRect.Tag, Support.Count, tempPosition, new RECTANGLE(tempPosition.cX, tempPosition.cY, (int)tempRect.Width, (int)tempRect.Height)));
                        }
                    }
                    else if (WorkspaceWorking.Children[i] is Rectangle && Support.IsImport == true)
                    {
                        ++Support.Count;
                        Rectangle tempImage = (Rectangle)WorkspaceWorking.Children[i];

                        if (tempImage.Tag != Support.gridLine)
                        {
                            OBJECT   temp         = new OBJECT((int)ObjectType.VIRTUAL_OBJECT, (int)tempImage.Tag, Support.Count, new VECTOR2D((float)Canvas.GetLeft(WorkspaceWorking.Children[i]), (float)Canvas.GetTop(WorkspaceWorking.Children[i])), new RECTANGLE((float)Canvas.GetLeft(WorkspaceWorking.Children[i]), (float)Canvas.GetTop(WorkspaceWorking.Children[i]), (int)tempImage.Width, (int)tempImage.Height));
                            VECTOR2D tempPosition = Support.ConvertCoordination(temp);
                            Support.listObject.Add(new OBJECT((int)ObjectType.VIRTUAL_OBJECT, (int)tempImage.Tag, Support.Count, tempPosition, new RECTANGLE(tempPosition.cX, tempPosition.cY, (int)tempImage.Width, (int)tempImage.Height)));
                        }
                    }
                }

                Support.IsImport = false;

                if (Support.quadTree == null)
                {
                    Support.quadTree = new CNode(0, PositionOfNode.TopLeft, new RECTANGLE(0, 8192, 8192, 8192));
                    for (int i = 0; i < Support.listObject.Count; ++i)
                    {
                        Support.quadTree.InsertObject(Support.quadTree, Support.listObject[i]);
                    }
                }
                ExportXml.getInstance().MWriter.WriteStartDocument();
                ExportXml.getInstance().WriteInfomationForMap();
                ExportXml.getInstance().writeQuadtreeToXml(Support.quadTree, ExportXml.getInstance().MWriter);
                ExportXml.getInstance().MWriter.WriteEndDocument();
                ExportXml.getInstance().MWriter.Close();

                Support.IsExportXml = true;
                MessageBox.Show("Map đã được tạo thành công, dùng file map.xml để load game nhé ^^", "Thông báo");
            }
            else
            {
                MessageBox.Show("Có map đâu mà đòi lưu ! - Muốn lưu hãy tạo map mới ^^", "Thông báo");
            }
        }
コード例 #10
0
ファイル: CNode.cs プロジェクト: tavietanh/ninja-gaiden
        public void InsertObject(CNode node, OBJECT obj)
        {
            RECTANGLE rect = RECTANGLE.Intersec(node.m_bound, obj.RangeOfMovement);

            if (rect.cX == 0 && rect.cY == 0 && rect.width == 0 && rect.height == 0)
            {
                return;
            }
            node.m_listObject.Add(obj);

            return;
        }
コード例 #11
0
ファイル: Script.cs プロジェクト: gtapwn/GTA5-Native-Caller
    public static int CreatePickup(string pickName, string probsName, int value = 1)
    {
        int pickHash = GAMEPLAY.GET_HASH_KEY(pickName.ToString());
        int propHash = 0;

        if (probsName != "default")
        {
            propHash = GAMEPLAY.GET_HASH_KEY(probsName.ToString());
        }
        Vector3 vec = GetPosition();

        return(OBJECT.CREATE_PICKUP(pickHash, vec.X, vec.Y, vec.Z, 700, value, true, propHash));
    }
コード例 #12
0
        public static void AddVehicle(string nr_object, string name, string obj_type, int id_client)
        {
            //Create new Employee
            LINQDataContext db         = new LINQDataContext();
            OBJECT          newVehicle = new OBJECT();

            newVehicle.nr_object = nr_object;
            newVehicle.name      = name;
            newVehicle.obj_type  = obj_type;
            newVehicle.id_client = id_client;

            //Add new Customer to database
            db.OBJECT.InsertOnSubmit(newVehicle);

            //Save changes to Database.
            db.SubmitChanges();
        }
コード例 #13
0
 public void ConvertToCanvasForFileExisted()
 {
     for (int i = 0; i < WorkspaceWorking.Children.Count; ++i)
     {
         if (WorkspaceWorking.Children[i] is Rectangle)
         {
             Rectangle tempRect = (Rectangle)WorkspaceWorking.Children[i];
             if ((int)tempRect.Tag == (int)ObjectID.TILE_BASE)
             {
                 ++Support.Count;
                 OBJECT   temp         = new OBJECT((int)ObjectType.VIRTUAL_OBJECT, (int)tempRect.Tag, Support.Count, new VECTOR2D((float)Canvas.GetLeft(WorkspaceWorking.Children[i]), (float)Canvas.GetTop(WorkspaceWorking.Children[i])), new RECTANGLE((float)Canvas.GetLeft(WorkspaceWorking.Children[i]), (float)Canvas.GetTop(WorkspaceWorking.Children[i]), (int)tempRect.Width, (int)tempRect.Height));
                 VECTOR2D tempPosition = Support.ConvertCoordination(temp);
                 Support.listObject.Add(new OBJECT((int)ObjectType.VIRTUAL_OBJECT, (int)tempRect.Tag, Support.Count, tempPosition, new RECTANGLE(tempPosition.cX, tempPosition.cY, (int)tempRect.Width, (int)tempRect.Height)));
             }
         }
     }
 }
コード例 #14
0
    public static OBJECT GetObjectData(string path)
    {
        OBJECT obj = new OBJECT();

        foreach (OBJECT data in objectsData)
        {
            if (data.path != null)
            {
                if (data.path == path)
                {
                    Debug.Log(data.path + "," + path);
                    obj = data;
                }
            }
        }
        return(obj);
    }
コード例 #15
0
    public static void SpawnWave(string path, Vector3 offset = new Vector3())
    {
        OBJECT enemy = new OBJECT();

        string temp = Resources.Load("Others/" + path, typeof(TextAsset)).ToString();

        if (temp == null)
        {
            return;
        }
        //行分け
        string[] lineText = temp.Split('\n');
        foreach (string line in lineText)
        {
            if (line[0] != '#')//コメントアウトは読み込まない
            {
                string[] dataText = line.Split(' ');
                //敵の数
                //敵の種類 x y Z    scale(記述なしで1)
                enemy       = GetObjectData(dataText[0]);
                enemy.pos.x = float.Parse(dataText[1]) * 10;
                enemy.pos.y = float.Parse(dataText[2]);
                enemy.pos.z = float.Parse(dataText[3]) * 10;
                if (dataText.Length >= 5)
                {
                    //enemy.scale = float.Parse(dataText[4]);これではいけない
                    //ene_001 2 3 4 ←4の右側に空白がある場合形式エラーが起きる
                    //成功検証のためTryParseを利用
                    if (!float.TryParse(dataText[4], out enemy.scale))
                    {
                        //空白があったら大体スケールの変更はないので等倍
                        enemy.scale = 3.0f;
                    }
                }
                else
                {
                    enemy.scale = 1.0f;
                }

                enemy.pos += offset;
                Debug.Log(enemy.pos);
                CreateObjectType(enemy);
            }
        }
    }
コード例 #16
0
        public static void AddObject(string nr, string name, Int32 id, string type)
        {
            //Create new Employee
            LINQDataContext db        = new LINQDataContext();
            OBJECT          newObject = new OBJECT();

            newObject.nr_object = nr;
            newObject.name      = name;
            newObject.id_client = id;
            newObject.obj_type  = type;

            //Add new Customer to database
            db.OBJECT.InsertOnSubmit(newObject);

            //Save changes to Database.
            db.SubmitChanges();
            return;
        }
コード例 #17
0
    //検出したタイプによって生成を変更させる
    public static void CreateObjectType(OBJECT data)
    {
        switch (data.type)
        {
        case "A":    //危害加えない
            Human.CreateHuman(data);
            break;

        case "B":    //敵
            Enemy.CreateEnemy(data);
            break;

        case "C":    //静止
            BaseObject.CreateObject(data.path);
            break;

        default:
            break;
        }
    }
コード例 #18
0
        public bool ConvertFromTileToObject()
        {
            if (Support.map != null)
            {
                if (Support.listObject == null)
                {
                    Support.listObject = new List <OBJECT>();
                }
                else if (Support.listObject.Count != 0)
                {
                    Support.listObject.Clear();
                }


                for (int i = 0; i < (int)(Support.map.BitMap.PixelHeight) / Support.HEIGHT_OF_TILE; ++i)
                {
                    for (int j = 0; j < (int)(Support.map.BitMap.PixelWidth) / Support.WIDTH_OF_TILE; ++j)
                    {
                        if (Support.listObject != null)
                        {
                            ++Support.Count;
                            OBJECT   tempObject   = new OBJECT((int)ObjectType.TILE_MAP, Support.map.ArrMap[i, j], Support.Count, new VECTOR2D(j * Support.WIDTH_OF_TILE, i * Support.HEIGHT_OF_TILE), new RECTANGLE(j * Support.WIDTH_OF_TILE, i * Support.HEIGHT_OF_TILE, Support.WIDTH_OF_TILE, Support.HEIGHT_OF_TILE));
                            VECTOR2D tempPosition = Support.ConvertCoordination(tempObject);
                            Support.listObject.Add(new OBJECT((int)ObjectType.TILE_MAP, Support.map.ArrMap[i, j], Support.Count, tempPosition, new RECTANGLE(tempPosition.cX, tempPosition.cY, Support.WIDTH_OF_TILE, Support.HEIGHT_OF_TILE)));
                        }
                    }
                }

                for (int i = 0; i < Support.map.ListLedPosition.Count; ++i)
                {
                    ++Support.Count;
                    OBJECT   tempObject = new OBJECT((int)ObjectType.LED_OBJECT, 0, Support.Count, new VECTOR2D(Support.map.ListLedPosition[i].cX, Support.map.ListLedPosition[i].cY), new RECTANGLE(Support.map.ListLedPosition[i].cX, Support.map.ListLedPosition[i].cY, 2, 2));
                    VECTOR2D position   = Support.ConvertCoordination(tempObject);
                    Support.listObject.Add(new OBJECT((int)ObjectType.LED_OBJECT, 0, Support.Count, new VECTOR2D(position.cX, position.cY), new RECTANGLE(position.cX, position.cY, 2, 2)));
                }

                return(true);
            }

            return(false);
        }
コード例 #19
0
        public static async Task <string> Add(HttpRequest Request)
        {
            Employee employeeRequestBody = await JSON.httpContextDeseriliser <Employee>(Request);

            bool roleExist = IsRoleExist(employeeRequestBody.designation);

            if (IsEmployeeExist(employeeRequestBody.id.ToString()))
            {
                return("Employee already Existed");
            }

            if (!roleExist)
            {
                return("Designation does not Exist");
            }

            string values = OBJECT.GetValues <Employee>(employeeRequestBody);
            string keys   = OBJECT.GetKeys <Employee>(employeeRequestBody);

            return(Insert(keys, values));
        }
コード例 #20
0
        internal virtual void OnObjectEdit(OBJECT entry)
        {
            //Get State
            bool ioState = io.Open;

            if (!ioState)
            {
                io.OpenIO();
            }

            //Write
            int index = Array.IndexOf(objects, entry);

            io.Position = objectAddresses[index];
            io.Out.Write(entry);

            //Close?
            if (!ioState)
            {
                io.CloseIO();
            }
        }
コード例 #21
0
 protected void pushParam(OBJECT param)
 {
     mParameterInfoList.Add(param);
 }
コード例 #22
0
        public void move_to_update_position(object sender, MouseEventArgs m)
        {
            if (isDragged == true && m.LeftButton == MouseButtonState.Pressed && (Support.IsVirtualObject == true || Support.IsJump == true || Support.IsVirtualWater == true))
            {
                if (rect != null)
                {
                    WorkspaceWorking.Children.Remove(rect);
                }

                endPosition = m.GetPosition(WorkspaceWorking);

                #region Scroll SrollViewer of Canvas
                if (endPosition.X > 800 + ScrollCanvas.HorizontalOffset)
                {
                    ScrollCanvas.ScrollToHorizontalOffset(ScrollCanvas.HorizontalOffset + 1);
                    ScrollCanvas.UpdateLayout();
                }
                #endregion

                endPosition.X = ((int)endPosition.X / Support.WIDHT_OF_VIRTUALOBJECT) * Support.WIDHT_OF_VIRTUALOBJECT;
                endPosition.Y = ((int)endPosition.Y / Support.HEIGHT_OF_VIRTUALOBJECT) * Support.HEIGHT_OF_VIRTUALOBJECT;

                if ((int)endPosition.X % Support.WIDHT_OF_VIRTUALOBJECT > 0 || (endPosition.X - startPosition.X) / Support.WIDHT_OF_VIRTUALOBJECT < 1)
                {
                    endPosition.X += Support.WIDHT_OF_VIRTUALOBJECT;
                }

                if ((int)endPosition.Y % Support.HEIGHT_OF_VIRTUALOBJECT > 0 || (endPosition.Y - startPosition.Y) / Support.HEIGHT_OF_VIRTUALOBJECT < 1)
                {
                    endPosition.Y += Support.HEIGHT_OF_VIRTUALOBJECT;
                }


                rect        = new Rectangle();
                rect.Tag    = Support.virtualObject;
                rect.Width  = (double)Math.Abs(endPosition.X - startPosition.X);
                rect.Height = (double)Math.Abs(endPosition.Y - startPosition.Y);
                if (Support.IsVirtualWater == true)
                {
                    rect.Stroke = new SolidColorBrush(Colors.Blue);
                }
                else if (Support.IsJump == false)
                {
                    rect.Stroke = new SolidColorBrush(Colors.Red);
                }
                else if (Support.IsJump == true)
                {
                    rect.Stroke = new SolidColorBrush(Colors.Green);
                }
                rect.StrokeThickness = 3;

                if (endPosition.X > startPosition.X)
                {
                    Canvas.SetLeft(rect, startPosition.X);
                    finalPosition.X = startPosition.X;
                }
                else
                {
                    Canvas.SetLeft(rect, endPosition.X);
                    finalPosition.X = endPosition.X;
                }

                if (startPosition.Y < endPosition.Y)
                {
                    Canvas.SetTop(rect, startPosition.Y);
                    finalPosition.Y = startPosition.Y;
                }
                else
                {
                    Canvas.SetTop(rect, endPosition.Y);
                    finalPosition.Y = endPosition.Y;
                }
                Canvas.SetZIndex(rect, 2);
                WorkspaceWorking.Children.Add(rect);
            }
            else
            {
                if (isDragged == true && m.LeftButton == MouseButtonState.Released)
                {
                    isDragged = false;
                    if (rect != null)
                    {
                        ++Support.Count;
                        if (Support.IsVirtualWater == false && Support.IsJump == false)
                        {
                            OBJECT   temp         = new OBJECT((int)ObjectType.VIRTUAL_OBJECT, 0, Support.Count, new VECTOR2D((float)finalPosition.X, (float)finalPosition.Y), new RECTANGLE((float)finalPosition.X, (float)finalPosition.Y, (int)rect.Width, (int)rect.Height));
                            VECTOR2D tempPosition = Support.ConvertCoordination(temp);


                            OBJECT obj = new OBJECT((int)ObjectType.VIRTUAL_OBJECT, 0, Support.Count, new VECTOR2D((float)tempPosition.cX, (float)tempPosition.cY), new RECTANGLE((float)tempPosition.cX, (float)tempPosition.cY, (int)rect.Width, (int)rect.Height));

                            if (Support.listObject == null)
                            {
                                Support.listObject = new List <OBJECT>();
                            }
                            if (obj.Bound.width != 0 && obj.Bound.height != 0)
                            {
                                Support.listObject.Add(obj);
                            }

                            obj = null;
                        }
                        else if (Support.IsVirtualWater == true)
                        {
                            OBJECT   temp         = new OBJECT((int)ObjectType.VIRTUAL_OBJECT, 0, Support.Count, new VECTOR2D((float)finalPosition.X, (float)finalPosition.Y), new RECTANGLE((float)finalPosition.X, (float)finalPosition.Y, (int)rect.Width, (int)rect.Height));
                            VECTOR2D tempPosition = Support.ConvertCoordination(temp);

                            EditPosition form = new EditPosition((int)tempPosition.cX, (int)tempPosition.cY);
                            form.ShowDialog();
                            tempPosition = new VECTOR2D(EditPosition.finalLocationX, EditPosition.finalLocationY);

                            OBJECT obj = new OBJECT((int)ObjectType.VIRTUAL_OBJECT, (int)ObjectID.VIRTUAL_OBJECT_WATER, Support.Count, new VECTOR2D((float)tempPosition.cX, (float)tempPosition.cY), new RECTANGLE((float)tempPosition.cX, (float)tempPosition.cY, (int)rect.Width, (int)rect.Height));

                            if (Support.listObject == null)
                            {
                                Support.listObject = new List <OBJECT>();
                            }
                            if (obj.Bound.width != 0 && obj.Bound.height != 0)
                            {
                                Support.listObject.Add(obj);
                            }

                            obj = null;
                        }
                        else if (Support.IsJump == true)
                        {
                            OBJECT   temp         = new OBJECT((int)ObjectType.VIRTUAL_OBJECT, 0, Support.Count, new VECTOR2D((float)finalPosition.X, (float)finalPosition.Y), new RECTANGLE((float)finalPosition.X, (float)finalPosition.Y, (int)rect.Width, (int)rect.Height));
                            VECTOR2D tempPosition = Support.ConvertCoordination(temp);

                            EditPosition form = new EditPosition((int)tempPosition.cX, (int)tempPosition.cY);
                            form.ShowDialog();
                            tempPosition = new VECTOR2D(EditPosition.finalLocationX, EditPosition.finalLocationY);

                            OBJECT obj = new OBJECT((int)ObjectType.VIRTUAL_OBJECT, (int)ObjectID.VIRTUAL_OBJECT_JUMP, Support.Count, new VECTOR2D((float)tempPosition.cX, (float)tempPosition.cY), new RECTANGLE((float)tempPosition.cX, (float)tempPosition.cY, (int)rect.Width, (int)rect.Height));

                            if (Support.listObject == null)
                            {
                                Support.listObject = new List <OBJECT>();
                            }
                            if (obj.Bound.width != 0 && obj.Bound.height != 0)
                            {
                                Support.listObject.Add(obj);
                            }

                            obj = null;
                        }
                    }
                    rect          = null;
                    startPosition = endPosition;
                }
            }

            // Update coordination for tb
            if (this.tbX != null && this.tbY != null)
            {
                this.tbX.Text = m.GetPosition(WorkspaceWorking).X.ToString();
                this.tbY.Text = (Support.HEIGHT_MAP - m.GetPosition(WorkspaceWorking).Y).ToString();
            }

            if (Support.IsEraser == false)
            {
                #region .For to create enemyobject

                if (selectedItemFromListbox != null && m.LeftButton != MouseButtonState.Pressed)
                {
                    isAdded = false;
                    WorkspaceWorking.Children.Remove(tempSelectedItem);

                    Image cursorImage = new Image();
                    cursorImage.Tag     = selectedItemFromListbox.Tag;
                    cursorImage.Source  = selectedItemFromListbox.Source;
                    cursorImage.Width   = selectedItemFromListbox.Width;
                    cursorImage.Height  = selectedItemFromListbox.Height;
                    cursorImage.Opacity = 0.8f;

                    positionTempOfSelectedFromListbox = m.GetPosition(WorkspaceWorking);

                    tempSelectedItem = cursorImage;

                    if (Support.IsAlign == true)
                    {
                        #region .Collision between rambo & virtualobject
                        for (int i = 0; i < WorkspaceWorking.Children.Count; ++i)
                        {
                            RECTANGLE cursor = new RECTANGLE((float)positionTempOfSelectedFromListbox.X, (float)positionTempOfSelectedFromListbox.Y, (int)cursorImage.Width, (int)cursorImage.Height);

                            if (WorkspaceWorking.Children[i] is Rectangle)
                            {
                                Rectangle convertingObject = (Rectangle)(WorkspaceWorking.Children[i]);
                                if (convertingObject.Tag == Support.virtualObject && ((int)cursorImage.Tag == (int)ObjectID.RAMBO ||
                                                                                      (int)cursorImage.Tag == (int)ObjectID.SNIPER_STANDING) || (int)cursorImage.Tag == (int)ObjectID.TANK ||
                                    (int)cursorImage.Tag == (int)ObjectID.ENEMY_BIG_GUN_SHOOTING || (int)cursorImage.Tag == (int)ObjectID.ENEMY_RUN)
                                {
                                    RECTANGLE tempRect      = new RECTANGLE((float)Canvas.GetLeft(WorkspaceWorking.Children[i]), (float)Canvas.GetTop(WorkspaceWorking.Children[i]), (int)convertingObject.Width, (int)convertingObject.Height);
                                    RECTANGLE collisionRect = RECTANGLE.IntersectCanvas(tempRect, cursor);
                                    if (collisionRect.width != 0 && collisionRect.height != 0)
                                    {
                                        positionTempOfSelectedFromListbox.Y = tempRect.cY - cursorImage.Height;
                                    }
                                }
                                else if (convertingObject.Tag == Support.gridLine && ((int)cursorImage.Tag == (int)ObjectID.GUN_ROTATING ||
                                                                                      (int)cursorImage.Tag == (int)ObjectID.BIG_GUN_ROTATING) || (int)cursorImage.Tag == (int)ObjectID.BRIDGE ||
                                         (int)cursorImage.Tag == (int)ObjectID.WEAPON_SENSOR || (int)cursorImage.Tag == (int)ObjectID.FIRE_BRIDGE || (int)cursorImage.Tag == (int)ObjectID.BIG_BOSS_1 || (int)cursorImage.Tag == (int)ObjectID.BIG_CAPSULE_BOSS)
                                {
                                    RECTANGLE tempRect      = new RECTANGLE((float)Canvas.GetLeft(WorkspaceWorking.Children[i]), (float)Canvas.GetTop(WorkspaceWorking.Children[i]), (int)convertingObject.Width, (int)convertingObject.Height);
                                    RECTANGLE collisionRect = RECTANGLE.IntersectCanvas(tempRect, cursor);
                                    if (collisionRect.width != 0 && collisionRect.height != 0)
                                    {
                                        positionTempOfSelectedFromListbox.X = tempRect.cX;
                                        positionTempOfSelectedFromListbox.Y = tempRect.cY;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    Canvas.SetLeft(cursorImage, (double)(positionTempOfSelectedFromListbox.X));
                    Canvas.SetTop(cursorImage, (double)(positionTempOfSelectedFromListbox.Y));
                    WorkspaceWorking.Children.Add(cursorImage);
                    #endregion
                }

                if (m.LeftButton == MouseButtonState.Pressed && selectedItemFromListbox != null && isAdded == false)
                {
                    WorkspaceWorking.Children.Remove(tempSelectedItem);
                    Image finalSelectedItem = new Image();
                    finalSelectedItem.Tag    = selectedItemFromListbox.Tag;
                    finalSelectedItem.Source = selectedItemFromListbox.Source;
                    finalSelectedItem.Width  = selectedItemFromListbox.Width;
                    finalSelectedItem.Height = selectedItemFromListbox.Height;

                    Canvas.SetLeft(finalSelectedItem, (double)(positionTempOfSelectedFromListbox.X));
                    Canvas.SetTop(finalSelectedItem, (double)(positionTempOfSelectedFromListbox.Y));
                    WorkspaceWorking.Children.Add(finalSelectedItem);
                    isAdded = true;

                    if ((int)finalSelectedItem.Tag == (int)ObjectID.WEAPON_CAPSULE || (int)finalSelectedItem.Tag == (int)ObjectID.WEAPON_SENSOR)
                    {
                        ItemList itemList = new ItemList(WorkspaceWorking, positionTempOfSelectedFromListbox);
                        itemList.ShowDialog();
                    }
                }
            }
            else
            {
                for (int i = 0; i < WorkspaceWorking.Children.Count; ++i)
                {
                    if (WorkspaceWorking.Children[i] is Image)
                    {
                        Image tempSelected = (Image)(WorkspaceWorking.Children[i]);
                        if ((int)tempSelected.Tag != (int)ObjectType.TILE_MAP)
                        {
                            RECTANGLE            rect      = new RECTANGLE((float)Canvas.GetLeft(WorkspaceWorking.Children[i]), (float)Canvas.GetTop(WorkspaceWorking.Children[i]), (int)tempSelected.Width, (int)tempSelected.Height);
                            System.Windows.Point tempPoint = new System.Windows.Point(m.GetPosition(WorkspaceWorking).X, m.GetPosition(WorkspaceWorking).Y);
                            if (rect.IsContain(tempPoint) == true)
                            {
                                WorkspaceWorking.Children.Remove(WorkspaceWorking.Children[i]);
                            }
                        }
                    }
                    else if (WorkspaceWorking.Children[i] is Rectangle)
                    {
                        Rectangle tempRect = (Rectangle)(WorkspaceWorking.Children[i]);
                        if (tempRect.Tag == Support.virtualObject && tempRect.Tag != Support.gridLine)
                        {
                            RECTANGLE            rect      = new RECTANGLE((float)Canvas.GetLeft(WorkspaceWorking.Children[i]), (float)Canvas.GetTop(WorkspaceWorking.Children[i]), (int)tempRect.Width, (int)tempRect.Height);
                            System.Windows.Point tempPoint = new System.Windows.Point(m.GetPosition(WorkspaceWorking).X, m.GetPosition(WorkspaceWorking).Y);
                            if (rect.IsContain(tempPoint) == true)
                            {
                                WorkspaceWorking.Children.Remove(WorkspaceWorking.Children[i]);
                            }
                        }
                    }
                }
            }
            #endregion
        }
コード例 #23
0
ファイル: ASTChecker.cs プロジェクト: zonnonproject/compiler
 protected override void Visit_OBJECT(OBJECT node)
 {
     /* MOVE CODE HERE */
 }
コード例 #24
0
 protected virtual void Visit_OBJECT(OBJECT node)
 {
 }