Inheritance: System.Web.UI.Page
Exemple #1
0
		public bool Remove(COLOR color,int amount)
		{
			AssertAndThrow.IsTrue (mana.ContainsKey (color));
			AssertAndThrow.IsTrue (amount > 0);

			return mana [color].Dec (amount);
		}
Exemple #2
0
 private static void EndTurn(ref int turn, ref COLOR nextPlayer)
 {
     turn++;
     foreach (Chesspiece c in board.Spaces)
     {
         if(c != null)
             c.UpdateMoves();
     }
     playerTurn = (COLOR)(turn % 2);
 }
Exemple #3
0
 protected static string AsString(COLOR color)
 {
     switch(color){
       case COLOR.RED:
     return "red";
       case COLOR.GREEN:
     return "green";
       case COLOR.BLUE:
     return "blue";
       default:
     return "unknown color";
     }
 }
Exemple #4
0
    public void changeColor(int turn)
    {
        //Update the game board and see if someone wins
        gameStateScript.GetComponent<GameStateScript>().updateGameBoard(id, turn);
        audioManager.playBlockRise (gameObject.transform.position);

        switch (turn) {
        case 0:
            color = COLOR.RED;
            gameObject.GetComponent<Renderer> ().material = redMaterial;
            break;

        case 1:
            color = COLOR.BLUE;
            gameObject.GetComponent<Renderer> ().material = blueMaterial;
            break;

        case 2:
            color = COLOR.BLACK;
            gameObject.GetComponent<Renderer> ().material = blackMaterial;
            break;
        }
    }
 public static partial Gdi32.HBRUSH GetSysColorBrush(COLOR nIndex);
Exemple #6
0
    /**
     * @brief 패킷 분석
     */
    public void ParsePacket(int len)
    {
        string msg = Encoding.UTF8.GetString(this.buf, 2, len - 2);

        string[] txt = msg.Split(':');

        // 상대가 타일을 누를때
        if (txt[0].Equals("SELECTING"))
        {
            if (!GameMng.I.myTurn)
            {
                GameMng.I.enemyClickTile(int.Parse(txt[1]), int.Parse(txt[2]));
            }
        }
        // 턴 넘김
        else if (txt[0].Equals("TURN"))
        {
            GameMng.I.turnManage(int.Parse(txt[1]));
        }
        else if (txt[0].Equals("CREATE_UNIT"))
        {
            // x값, y값, 유닛 코드, 생성자, 건물 x값, 건물 y값
            GameMng.I._BuiltGM.CreateUnit(int.Parse(txt[1]), int.Parse(txt[2]), int.Parse(txt[3]), int.Parse(txt[4]), int.Parse(txt[5]), int.Parse(txt[6]));
        }
        else if (txt[0].Equals("CREATE_BUILT"))
        {
            // x값, y값, 건물 코드, 생성자, 건물 x값, 건물 y값
            GameMng.I._UnitGM.CreateBuilt(int.Parse(txt[1]), int.Parse(txt[2]), int.Parse(txt[3]), int.Parse(txt[4]), int.Parse(txt[5]), int.Parse(txt[6]));
        }
        else if (txt[0].Equals("CREATE_AIRDROP"))
        {
            // 보급이 생성될 배열의 번호, 보급이 떨어질 곳의 코드 값
            GameMng.I._BuiltGM.CreateAirDrop(int.Parse(txt[1]), int.Parse(txt[2]));
        }
        else if (txt[0].Equals("MOVE_UNIT"))
        {
            // 현재 x값, y값, 이동할 x값, y값
            StartCoroutine(GameMng.I._UnitGM.MovingUnit(int.Parse(txt[1]), int.Parse(txt[2]), int.Parse(txt[3]), int.Parse(txt[4])));
        }
        else if (txt[0].Equals("ATTACK"))
        {
            // 오브젝트 x값, y값, 공격할 x값, y값
            // 현재 오브젝트를 찾아서 공격력 찾은 다음 대상 위치의 hp 를 깎음
            GameMng.I.attack(int.Parse(txt[1]), int.Parse(txt[2]), int.Parse(txt[3]), int.Parse(txt[4]), int.Parse(txt[5]));
        }
        else if (txt[0].Equals("ATTACK_TURRET"))
        {
            // 오브젝트 x값, y값, 공격 대미지
            // 공격한 터렛 오브젝트를 찾아서 범위 안의 유닛의 hp 를 깎음
            GameMng.I.TurretAttack(int.Parse(txt[1]), int.Parse(txt[2]), int.Parse(txt[3]), int.Parse(txt[4]));
        }
        else if (txt[0].Equals("CHAT"))
        {
            GameMng.I._chat.newMessage(txt[1], txt[2]);
        }
        else if (txt[0].Equals("PLUNDER"))
        {
            Debug.Log(txt[1] + "," + txt[2] + "," + txt[3] + "," + txt[4]);
            // 공격한 사람 고유번호, 공격당한 사람 고유번호, 약달한 자원, 약탈한 자원종류, 공격당한 posX, 공격당한 posY
            string attackername = GameMng.I.getUserName(int.Parse(txt[2]));
            switch (int.Parse(txt[4]))
            {
            case 0:
                if (uniqueNumber.Equals(int.Parse(txt[1])))
                {
                    GameMng.I.addActMessage(string.Format("{0}에게 골드를 {1} 약탈했습니다.", attackername, txt[3]), int.Parse(txt[5]), int.Parse(txt[6]));
                    GameMng.I.addLogMessage(attackername, string.Format("에게 골드를 {0} 약탈했습니다.", txt[3]));
                    GameMng.I.addGold(int.Parse(txt[3]));
                }
                else if (uniqueNumber.Equals(int.Parse(txt[2])))
                {
                    GameMng.I.addActMessage(string.Format("{0}에게 골드를 {1} 약탈당했습니다.", attackername, txt[3]), int.Parse(txt[5]), int.Parse(txt[6]));
                    GameMng.I.addLogMessage(attackername, string.Format("에게 골드를 {0} 약탈당했습니다.", txt[3]));
                    GameMng.I.minGold(int.Parse(txt[3]));
                }
                break;

            case 1:
                if (uniqueNumber.Equals(int.Parse(txt[1])))
                {
                    GameMng.I.addActMessage(string.Format("{0}에게 식량을 {1} 약탈했습니다.", attackername, txt[3]), int.Parse(txt[5]), int.Parse(txt[6]));
                    GameMng.I.addLogMessage(attackername, string.Format("에게 식량을 {0} 약탈했습니다.", txt[3]));
                    GameMng.I.addFood(int.Parse(txt[3]));
                }
                else if (uniqueNumber.Equals(int.Parse(txt[2])))
                {
                    GameMng.I.addActMessage(string.Format("{0}에게 식량을 {1} 약탈당했습니다.", attackername, txt[3]), int.Parse(txt[5]), int.Parse(txt[6]));
                    GameMng.I.addLogMessage(attackername, string.Format("에게 식량을 {0} 약탈당했습니다.", txt[3]));
                    GameMng.I.minFood(int.Parse(txt[3]));
                }
                break;
            }
        }
        else if (txt[0].Equals("DIE_UNIT"))
        {
            GameMng.I._hextile.GetCell(int.Parse(txt[1]), int.Parse(txt[2]))._unitObj.DestroyMyself();
            GameMng.I._hextile.GetCell(int.Parse(txt[1]), int.Parse(txt[2]))._unitObj = null;
            GameMng.I._hextile.TilecodeClear(int.Parse(txt[1]), int.Parse(txt[2]));
        }
        else if (txt[0].Equals("DESTROY_BUILT"))
        {
            GameMng.I._BuiltGM.DestroyBuilt(int.Parse(txt[1]), int.Parse(txt[2]));
        }
        // 방에 있던 사람 중 누군가 나감
        else if (txt[0].Equals("SOMEONE_EXIT"))
        {
            if (uniqueNumber.Equals(int.Parse(txt[1])))
            {
                v_user.Clear();
                return;
            }

            int i;
            for (i = 0; i < v_user.Count; i++)
            {
                if (v_user[i].uniqueNumber.Equals(int.Parse(txt[1])))
                {
                    break;
                }
            }
            v_user.RemoveAt(i);

            _roomGM.roomRefresh();
        }
        // 게임 도중 방에 있던 사람 중 누군가 나감 SOMEONE_EXIT 와는 상황이 조금 다름
        else if (txt[0].Equals("LOGOUT"))
        {
            if (v_user.Count == 0)
            {
                return;
            }

            if (firstPlayerUniqueNumber != -1)
            {
                GameMng.I.UserExit(int.Parse(txt[1]));
            }

            //int i;
            //for (i = 0; i < v_user.Count; i++)
            //{
            //    if (v_user[i].uniqueNumber.Equals(int.Parse(txt[1])))
            //    {
            //        break;
            //    }
            //}

            //v_user.RemoveAt(i);

            if (firstPlayerUniqueNumber == -1)    // 인게임이라면 사용안함
            {
                _roomGM.roomRefresh();
            }
        }
        // 직접 방 생성후 이동
        else if (txt[0].Equals("CHANGE_ROOM"))
        {
            myRoom = int.Parse(txt[1]);
            // 광장이 아닐때
            if (!myRoom.Equals(0))
            {
                _roomGM.changeRoom();
            }
        }
        // 방 정보 받음
        else if (txt[0].Equals("FOUND_ROOM"))
        {
            _roomGM.makeGate(txt[1], txt[2], txt[3], txt[4], txt[5]);
        }
        // 방에 접속 시도후 받음
        else if (txt[0].Equals("ENTER_ROOM"))
        {
            if (txt[1].Equals("IN"))
            {
                for (int k = 0; k < (txt.Length - 2) / 4; k++)
                {
                    UserInfo userInfo = new UserInfo
                    {
                        nickName     = txt[3 + k * 4],
                        uniqueNumber = int.Parse(txt[4 + k * 4]),
                        tribe        = int.Parse(txt[5 + k * 4]),
                        color        = int.Parse(txt[6 + k * 4])
                    };
                    v_user.Add(userInfo);

                    if (uniqueNumber.Equals(int.Parse(txt[4 + k * 4])))
                    {
                        myColor = (COLOR)(int.Parse(txt[6 + k * 4]));
                    }
                }
                _roomGM.intoRoom(txt[2]);
                _roomGM.roomRefresh();
            }
            else if (txt[1].Equals("LIMIT"))
            {
                myRoom = 0;
            }
            else if (txt[1].Equals("MISS"))
            {
                myRoom = 0;
            }
        }
        // 누군가 대기 방에서 나갔을때 방 주인 변경
        else if (txt[0].Equals("NOW_ROOM_OWNER"))
        {
            roomOwner = true;
            _roomGM.nowRoomOwner();
        }
        // 누군가 게임 도중 나갔을때 방 주인을 변경할때 호출됨
        else if (txt[0].Equals("CHANGE_ROOM_OWNER"))
        {
            roomOwner = true;
        }
        else if (txt[0].Equals("LOSE"))
        {
            for (int i = 0; i < v_user.Count; i++)
            {
                if (v_user[i].uniqueNumber.Equals(int.Parse(txt[1])))
                {
                    GameMng.I.addActMessage(
                        string.Format("● {0}님이 패배했습니다. ●", GameMng.I.getUserName(int.Parse(txt[1]))),
                        GameMng.I._hextile.starttile[v_user[i].startPos].PosX,
                        GameMng.I._hextile.starttile[v_user[i].startPos].PosZ);
                    GameMng.I.addLogMessage(GameMng.I.getUserName(int.Parse(txt[1])), "패배했습니다.");
                    break;
                }
            }

            // Tab UI 에서 죽은 유저로 표시하기
            GameMng.I.UserExit(int.Parse(txt[1]));
        }
        else if (txt[0].Equals("WIN"))
        {
            GameMng.I.winUI.SetActive(true);
        }
        else if (txt[0].Equals("TRIBE"))
        {
            // 종족을 변경하는 유저의 코드와 변경하는 종족의 코드
            _roomGM.changeTribe(int.Parse(txt[1]), int.Parse(txt[2]));
        }
        else if (txt[0].Equals("COLOR"))
        {
            // 색상을 변경하는 유저의 코드와 변경하는 색상의 코드
            _roomGM.changeColor(int.Parse(txt[1]), int.Parse(txt[2]));
        }
        else if (txt[0].Equals("GAME_START"))
        {
            Debug.Log(msg);

            //uniqueNumber = int.Parse(txt[1]);

            Debug.Log("GAME START !!!");
            _soundGM.waitBGM();
            Debug.Log("txt 메세지 사이즈 (2개 + 3*인원수 여야됨) : " + txt.Length);

            // 1: 고유번호, 2: 첫 시작 위치
            for (int k = 0; k < (txt.Length - 1) / 2; k++)
            {
                for (int j = 0; j < v_user.Count; j++)
                {
                    if (v_user[j].uniqueNumber == int.Parse(txt[1 + k * 2]))
                    {
                        UserInfo info = v_user[j];
                        info.startPos = int.Parse(txt[2 + k * 2]);
                        v_user[j]     = info;
                        break;
                    }
                }
            }

            firstPlayerUniqueNumber = int.Parse(txt[1]);
            SceneManager.LoadScene("InGame");
        }
        else if (txt[0].Equals("UNIQUE"))
        {
            uniqueNumber = int.Parse(txt[1]);
        }
        // 접속 - 첫 로그인
        else if (txt[0].Equals("CONNECT"))
        {
            Debug.Log("Connected.");
            SendMsg(string.Format("LOGIN:{0}", nickName));
            profileNickname.text = nickName;
        }
        // 누군가 들어올때 받음
        else if (txt[0].Equals("SOMEONE_ENTER"))
        {
            UserInfo tempUser = new UserInfo
            {
                nickName     = txt[1],
                uniqueNumber = int.Parse(txt[2]),
                tribe        = int.Parse(txt[3]),
                color        = int.Parse(txt[4])
            };
            v_user.Add(tempUser);
            _roomGM.roomRefresh();
        }
    }
Exemple #7
0
 public Vertex(int ch, COLOR color)
 {
     CharValue = ch;
     Color     = color;
 }
Exemple #8
0
 public void ChangeColorByName(COLOR _c)
 {
     Debug.Log("Cambiar color");
     // GetComponent<MeshRenderer>().material.SetColor("_Color", colors[(int)_c]);
 }
Exemple #9
0
 /// <summary>
 /// Function: SetIndexStyle
 /// Description: Sets the new type, style, width and color for a given indicator line.
 /// URL: http://docs.mql4.com/customind/setindexstyle.html
 /// </summary>
 /// <param name="index">[in] Line index. Must lie between 0 and 7.</param>
 /// <param name="type">[in] Shape style. Can be one of listed.</param>
 /// <param name="style">[in] Drawing style. It is used for one-pixel thick lines. It can be one of the listed. EMPTY value means that the style will not be changed.</param>
 /// <param name="width">[in] Line width. Valid values are: 1,2,3,4,5. EMPTY value means that width will not be changed.</param>
 /// <param name="clr">[in] Line color. Absence of this parameter means that the color will not be changed.</param>
 public void SetIndexStyle(int index, int type, int style, int width, COLOR clr)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(index);
     parameters.Add(type);
     parameters.Add(style);
     parameters.Add(width);
     parameters.Add(clr);
     int id = getCommandManager().ExecCommand(MQLCommand.SetIndexStyle_1, parameters); // MQLCommand ENUM = 168
     while (getCommandManager().IsCommandRunning(id))
     {
         //Thread.Sleep(1);
     }
     getCommandManager().throwExceptionIfErrorResponse(id);
 }
Exemple #10
0
 /// <summary>
 /// Function: OrderClose
 /// Description: Closes opened order.
 /// URL: http://docs.mql4.com/trading/orderclose.html
 /// </summary>
 /// <param name="ticket">[in] Unique number of the order ticket.</param>
 /// <param name="lots">[in] Number of lots.</param>
 /// <param name="price">[in] Closing price.</param>
 /// <param name="slippage">[in] Value of the maximum price slippage in points.</param>
 /// <param name="arrow_color">[in] Color of the closing arrow on the chart. If the parameter is missing or has CLR_NONE value closing arrow will not be drawn on the chart.</param>
 public bool OrderClose(int ticket, double lots, double price, int slippage, COLOR arrow_color)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(ticket);
     parameters.Add(lots);
     parameters.Add(price);
     parameters.Add(slippage);
     parameters.Add(arrow_color);
     int id = getCommandManager().ExecCommand(MQLCommand.OrderClose_1, parameters); // MQLCommand ENUM = 107
     while (getCommandManager().IsCommandRunning(id))
     {
         //Thread.Sleep(1);
     }
     getCommandManager().throwExceptionIfErrorResponse(id);
     return (bool)getCommandManager().GetCommandResult(id);
 }
Exemple #11
0
 /// <summary>
 /// Function: SetIndexStyle
 /// Description: Sets the new type, style, width and color for a given indicator line.
 /// URL: http://mm.l/mql4/docs.mql4.com/customind/setindexstyle.html
 /// </summary>
 /// <param name="index">[in] Line index. Must lie between 0 and 7.</param>
 /// <param name="type">[in] Shape style. Can be one of listed.</param>
 /// <param name="style">[in] Drawing style. It is used for one-pixel thick lines. It can be one of the listed. EMPTY value means that the style will not be changed.</param>
 /// <param name="width">[in] Line width. Valid values are: 1,2,3,4,5. EMPTY value means that width will not be changed.</param>
 /// <param name="clr">[in] Line color. Absence of this parameter means that the color will not be changed.</param>
 public void SetIndexStyle(int index, int type, int style, int width, COLOR clr)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(index);
     parameters.Add(type);
     parameters.Add(style);
     parameters.Add(width);
     parameters.Add(clr);
     MQLCommandManager.getInstance().ExecCommand(MQLCommand.SetIndexStyle_1, parameters); // MQLCommand ENUM = 168
     while (MQLCommandManager.getInstance().IsCommandRunning()) Thread.Sleep(1);
 }
Exemple #12
0
    // Use this for initialization
    void Start()
    {
        scaleY = false;
        id = index;
        index += 1;
        color = COLOR.GREY;

        //get the script associated with the object
        GameObject g = GameObject.Find ("GameManager");
        globalObj = g.GetComponent< GameScript >();

        GameObject g2 = GameObject.Find ("AudioManager");
        audioManager = g2.GetComponent< AudioManagerScript> ();

        //Make color based on boundary
        if (id == 1 || id == globalObj.boardSize + 2 || id == ((globalObj.boardSize + 2) * (globalObj.boardSize + 2)) || id == ((globalObj.boardSize + 1) * (globalObj.boardSize + 2) + 1)) {
            rise (2);
        }
        else if ( id <= globalObj.boardSize + 2 || id > (globalObj.boardSize + 1) * (globalObj.boardSize + 2) ) {
            rise(0);
        }
        else if ( (id % (globalObj.boardSize+2) == 0) || (id % (globalObj.boardSize+2) == 1) ) {
            rise(1);
        }
    }
Exemple #13
0
 public static extern IntPtr GetSysColorBrush(COLOR nIndex);
Exemple #14
0
 public static extern COLORREF GetSysColor(COLOR nIndex);
Exemple #15
0
 public Queen(COLOR color, int x, int y)
     : base(color, x, y)
 {
 }
Exemple #16
0
 /// <summary>
 /// Function: ObjectSetText
 /// Description: The function c
 /// URL: http://mm.l/mql4/docs.mql4.com/objects/objectsettext.html
 /// </summary>
 /// <param name="object_name">[in] Object name.</param>
 /// <param name="text">[in] A text describing the object.</param>
 /// <param name="font_size">[in] Font size in points.</param>
 /// <param name="font_name">[in] Font name.</param>
 /// <param name="text_color">[in] Font color.</param>
 public bool ObjectSetText(string object_name, string text, int font_size, string font_name, COLOR text_color)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(object_name);
     parameters.Add(text);
     parameters.Add(font_size);
     parameters.Add(font_name);
     parameters.Add(text_color);
     MQLCommandManager.getInstance().ExecCommand(MQLCommand.ObjectSetText_1, parameters); // MQLCommand ENUM = 194
     while (MQLCommandManager.getInstance().IsCommandRunning()) Thread.Sleep(1);
     return (bool) MQLCommandManager.getInstance().GetCommandResult();
 }
Exemple #17
0
 /// <summary>
 /// Function: SetLevelStyle
 /// Description: The function sets a new style, width and color of horizontal levels of indicator to be output in a separate window.
 /// URL: http://mm.l/mql4/docs.mql4.com/customind/setlevelstyle.html
 /// </summary>
 /// <param name="draw_style">[in] Drawing style. Can be one of the listed. EMPTY value means that the style will not be changed.</param>
 /// <param name="line_width">[in] Line width. Valid values are 1,2,3,4,5. EMPTY value indicates that the width will not be changed.</param>
 /// <param name="clr">[in] Line color. Empty value CLR_NONE means that the color will not be changed.</param>
 public void SetLevelStyle(int draw_style, int line_width, COLOR clr)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(draw_style);
     parameters.Add(line_width);
     parameters.Add(clr);
     MQLCommandManager.getInstance().ExecCommand(MQLCommand.SetLevelStyle_1, parameters); // MQLCommand ENUM = 169
     while (MQLCommandManager.getInstance().IsCommandRunning()) Thread.Sleep(1);
 }
Exemple #18
0
        /// <summary>
        /// 获取蓝色风格的颜色
        /// </summary>
        /// <param name="color">颜色</param>
        /// <returns>新的颜色</returns>
        public static long GetBlueColor(long dwPenColor)
        {
            long color = dwPenColor;

            if (color < COLOR.EMPTY)
            {
                if (color > PCOLORS_USERCOLOR)
                {
                    if (color == COLOR.CONTROL)
                    {
                        color = COLOR.ARGB(0, 0, 0);
                    }
                    else if (color == COLOR.CONTROLBORDER)
                    {
                        color = COLOR.ARGB(43, 138, 195);
                    }
                    else if (color == COLOR.CONTROLTEXT)
                    {
                        color = COLOR.ARGB(255, 255, 255);
                    }
                    else if (color == COLOR.DISABLEDCONTROL)
                    {
                        color = COLOR.ARGB(25, 255, 255, 255);
                    }
                    else if (color == COLOR.DISABLEDCONTROLTEXT)
                    {
                        color = 3289650;
                    }
                    else if (color == COLOR.HOVEREDCONTROL)
                    {
                        color = COLOR.ARGB(150, 43, 138, 195);
                    }
                    else if (color == COLOR.PUSHEDCONTROL)
                    {
                        color = COLOR.ARGB(100, 43, 138, 195);
                    }
                }
                else if (color == PCOLORS_BACKCOLOR)
                {
                    color = COLOR.ARGB(180, 43, 138, 195);
                }
                else if (color == PCOLORS_BACKCOLOR2)
                {
                    color = COLOR.ARGB(130, 43, 138, 195);
                }
                else if (color == PCOLORS_BACKCOLOR3)
                {
                    color = COLOR.ARGB(25, 255, 255, 255);
                }
                else if (color == PCOLORS_BACKCOLOR4)
                {
                    color = COLOR.ARGB(25, 0, 0, 0);
                }
                else if (color == PCOLORS_BACKCOLOR5)
                {
                    color = COLOR.ARGB(75, 51, 153, 255);
                }
                else if (color == PCOLORS_BACKCOLOR6)
                {
                    color = COLOR.ARGB(50, 51, 153, 255);
                }
                else if (color == PCOLORS_BACKCOLOR7)
                {
                    color = COLOR.ARGB(100, 255, 255, 255);
                }
                else if (color == PCOLORS_BACKCOLOR9)
                {
                    color = COLOR.ARGB(9, 30, 42);
                }
                else if (color == PCOLORS_FORECOLOR)
                {
                    color = COLOR.ARGB(255, 255, 255);
                }
                else if (color == PCOLORS_FORECOLOR2)
                {
                    color = COLOR.ARGB(112, 112, 112);
                }
                else if (color == PCOLORS_FORECOLOR3)
                {
                    color = COLOR.ARGB(100, 255, 255, 255);
                }
                else if (color == PCOLORS_LINECOLOR)
                {
                    color = COLOR.ARGB(43, 120, 195);
                }
                else if (color == PCOLORS_LINECOLOR2)
                {
                    color = COLOR.ARGB(51, 153, 255);
                }
                else if (color == CDraw.PCOLORS_UPCOLOR)
                {
                    color = COLOR.ARGB(255, 82, 82);
                }
                else if (color == CDraw.PCOLORS_DOWNCOLOR)
                {
                    color = COLOR.ARGB(80, 255, 80);
                }
                else if (color == CDraw.PCOLORS_LINECOLOR3)
                {
                    color = COLOR.ARGB(5, 255, 255, 255);
                }
                else if (color == PCOLORS_SELECTEDROWCOLOR)
                {
                    color = COLOR.ARGB(43, 138, 195);
                }
                else if (color == PCOLORS_HOVEREDROWCOLOR)
                {
                    color = COLOR.ARGB(200, 43, 138, 195);
                }
                else if (color == PCOLORS_ALTERNATEROWCOLOR)
                {
                    color = COLOR.ARGB(100, 43, 138, 195);
                }
                else if (color == CDraw.PCOLORS_WINDOWFORECOLOR)
                {
                    color = COLOR.ARGB(255, 255, 255, 255);
                }
                else if (color == CDraw.PCOLORS_WINDOWBACKCOLOR)
                {
                    color = COLOR.ARGB(255, 50, 50, 50);
                }
                else if (color == CDraw.PCOLORS_WINDOWBACKCOLOR2)
                {
                    color = COLOR.ARGB(230, 43, 138, 195);
                }
                else if (color == CDraw.PCOLORS_WINDOWCONTENTBACKCOLOR)
                {
                    color = COLOR.ARGB(235, 9, 30, 42);
                }
            }
            return(color);
        }
Exemple #19
0
        public static IMAGE32 RenderText(this SixLabors.Fonts.FontFamily ffamily, string text, float fsize, float padding, COLOR color, TextGraphicsOptions options)
        {
            // http://sixlabors.com/2017/04/08/watermarks/

            if (string.IsNullOrEmpty(text))
            {
                return(null);
            }

            var font     = new SixLabors.Fonts.Font(ffamily, fsize);
            var roptions = new SixLabors.Fonts.RendererOptions(font, 96);
            var size     = SixLabors.Fonts.TextMeasurer.Measure(text, roptions);

            var w   = (int)Math.Ceiling(size.Width + padding * 2);
            var h   = (int)Math.Ceiling(size.Height + padding * 2);
            var img = new IMAGE32(w, h);

            img.Mutate(dc => dc.DrawText(options, text, font, color, new System.Numerics.Vector2(padding, padding)));

            return(img);
        }
Exemple #20
0
 public pawn(COLOR color, int x, int y)
     : base(color, x, y)
 {
 }
Exemple #21
0
        /// <summary>
        /// 插入行数据
        /// </summary>
        /// <param name="jira">Jira对象</param>
        public void Addrows(Jira jira)
        {
            m_gridDgvTable.BeginUpdate();
            //设置样式
            GridCellStyle gridStyle = new GridCellStyle();

            gridStyle.BackColor = COLOR.DISABLEDCONTROL;
            GridRow row = new GridRow();

            m_gridDgvTable.AddRow(row);
            //设置边框线的颜色
            m_gridDgvTable.GridLineColor = COLOR.EMPTY;
            m_gridDgvTable.HeaderHeight  = 35;
            m_gridDgvTable.BackColor     = COLOR.ARGB(31, 29, 40);
            row.Tag = jira;
            //设置行高
            row.Height = 35;
            GridCell cell1 = new GridCellExp(jira.JiraID);

            row.AddCell("colT1", cell1);
            GridCellStyle gridStyle1 = new GridCellStyle();

            gridStyle1.BackColor = COLOR.DISABLEDCONTROL;
            gridStyle1.ForeColor = COLOR.ARGB(255, 255, 255);
            cell1.Style          = gridStyle1;
            GridCell cell2 = new GridCellExp(jira.Title);

            row.AddCell("colT2", cell2);
            GridCellStyle gridStyle2 = new GridCellStyle();

            gridStyle2.BackColor = COLOR.DISABLEDCONTROL;
            gridStyle2.ForeColor = COLOR.ARGB(45, 142, 45);
            cell2.Style          = gridStyle2;
            GridCell cell3 = new GridCellExp(jira.Creater);

            row.AddCell("colT3", cell3);
            GridCell cell4 = new GridCellExp(jira.Developer);

            row.AddCell("colT4", cell4);
            GridCellStyle gridStyle3 = new GridCellStyle();

            gridStyle3.BackColor = COLOR.DISABLEDCONTROL;
            gridStyle3.ForeColor = COLOR.ARGB(47, 145, 145);
            cell3.Style          = gridStyle3;
            cell4.Style          = gridStyle3;
            int count = XmlHandle.Groups.Count;

            for (int j = 0; j < count; j++)
            {
                JGroup group = XmlHandle.Groups[j];
                if (group.Id == jira.GroupID)
                {
                    GridCell cell5 = new GridCellExp(group.Name);
                    row.AddCell("colT5", cell5);
                    GridCellStyle gridStyle5 = new GridCellStyle();
                    gridStyle5.BackColor = COLOR.DISABLEDCONTROL;
                    gridStyle5.ForeColor = COLOR.ARGB(47, 145, 145);
                    cell5.Style          = gridStyle5;
                    GridCell cell6 = new GridCellExp(group.Manager);
                    row.AddCell("colT6", cell6);
                    GridCellStyle gridStyle6 = new GridCellStyle();
                    gridStyle6.BackColor = COLOR.DISABLEDCONTROL;
                    gridStyle6.ForeColor = COLOR.ARGB(255, 153, 153);
                    cell6.Style          = gridStyle6;
                    List <JCategory> categories = group.Categories;
                    int categoriesCount         = categories.Count;
                    for (int n = 0; n < categoriesCount; n++)
                    {
                        if (categories[n].Id == jira.CategoryID)
                        {
                            GridCell cell7 = new GridCellExp(categories[n].Name);
                            row.AddCell("colT7", cell7);
                            GridCellStyle gridStyle7 = new GridCellStyle();
                            gridStyle7.BackColor = COLOR.DISABLEDCONTROL;
                            gridStyle7.ForeColor = COLOR.ARGB(45, 142, 45);
                            cell7.Style          = gridStyle7;
                            break;
                        }
                    }
                    break;
                }
            }
            String        str        = jira.DeveloperReceive ? "是" : "否";
            GridCell      cell8      = new GridCellExp(str);
            GridCellStyle gridStyle8 = new GridCellStyle();

            gridStyle8.ForeColor = COLOR.ARGB(255, 255, 255);
            if (str == "是")
            {
                gridStyle8.BackColor = COLOR.ARGB(93, 146, 202);
            }
            else
            {
                gridStyle8.BackColor = COLOR.ARGB(163, 5, 50);
            }
            cell8.Style = gridStyle8;
            row.AddCell("colT8", cell8);
            String        str1       = jira.DeveloperPass ? "是" : "否";
            GridCell      cell9      = new GridCellExp(str1);
            GridCellStyle gridStyle9 = new GridCellStyle();

            gridStyle9.ForeColor = COLOR.ARGB(255, 255, 255);
            if (str1 == "是")
            {
                gridStyle9.BackColor = COLOR.ARGB(93, 146, 202);
            }
            else
            {
                gridStyle9.BackColor = COLOR.ARGB(163, 5, 50);
            }
            cell9.Style = gridStyle9;
            row.AddCell("colT9", cell9);
            String        str2        = jira.TestPass ? "是" : "否";
            GridCell      cell10      = new GridCellExp(str2);
            GridCellStyle gridStyle10 = new GridCellStyle();

            gridStyle10.ForeColor = COLOR.ARGB(255, 255, 255);
            if (str2 == "是")
            {
                gridStyle10.BackColor = COLOR.ARGB(93, 146, 202);
            }
            else
            {
                gridStyle10.BackColor = COLOR.ARGB(163, 5, 50);
            }
            cell10.Style = gridStyle10;
            row.AddCell("colT10", cell10);
            String        str3        = jira.ProductPass ? "是" : "否";
            GridCell      cell11      = new GridCellExp(str3);
            GridCellStyle gridStyle11 = new GridCellStyle();

            gridStyle11.ForeColor = COLOR.ARGB(255, 255, 255);
            if (str3 == "是")
            {
                gridStyle11.BackColor = COLOR.ARGB(93, 146, 202);
            }
            else
            {
                gridStyle11.BackColor = COLOR.ARGB(163, 5, 50);
            }
            cell11.Style = gridStyle11;
            row.AddCell("colT11", cell11);
            String        str4        = jira.WaitPublish ? "是" : "否";
            GridCell      cell12      = new GridCellExp(str4);
            GridCellStyle gridStyle12 = new GridCellStyle();

            gridStyle12.ForeColor = COLOR.ARGB(255, 255, 255);
            if (str4 == "是")
            {
                gridStyle12.BackColor = COLOR.ARGB(93, 146, 202);
            }
            else
            {
                gridStyle12.BackColor = COLOR.ARGB(163, 5, 50);
            }
            cell12.Style = gridStyle12;
            row.AddCell("colT12", cell12);
            String        str5        = jira.Published ? "是" : "否";
            GridCell      cell13      = new GridCellExp(str5);
            GridCellStyle gridStyle13 = new GridCellStyle();

            gridStyle13.ForeColor = COLOR.ARGB(255, 255, 255);
            if (str5 == "是")
            {
                gridStyle13.BackColor = COLOR.ARGB(93, 146, 202);
            }
            else
            {
                gridStyle13.BackColor = COLOR.ARGB(163, 5, 50);
            }
            cell13.Style = gridStyle13;
            row.AddCell("colT13", cell13);

            String        str6        = jira.CloseTask ? "是" : "否";
            GridCell      cell14      = new GridCellExp(str6);
            GridCellStyle gridStyle14 = new GridCellStyle();

            gridStyle14.ForeColor = COLOR.ARGB(255, 255, 255);
            if (str6 == "是")
            {
                gridStyle14.BackColor = COLOR.ARGB(93, 146, 202);
            }
            else
            {
                gridStyle14.BackColor = COLOR.ARGB(163, 5, 50);
            }
            cell14.Style = gridStyle14;
            row.AddCell("colT14", cell14);

            GridCell      cell15      = new GridCellExp(jira.Hurry);
            GridCellStyle gridStyle15 = new GridCellStyle();

            gridStyle15.BackColor = COLOR.ARGB(0, 0, 0);
            if (jira.Hurry == "紧急")
            {
                gridStyle15.ForeColor = COLOR.ARGB(255, 0, 0);
            }
            else
            {
                gridStyle15.ForeColor = COLOR.ARGB(255, 255, 0);
            }
            cell15.Style = gridStyle15;
            row.AddCell("colT15", cell15);
            GridCellStyle gridStyle16 = new GridCellStyle();

            gridStyle16.BackColor = COLOR.DISABLEDCONTROL;
            gridStyle16.ForeColor = COLOR.ARGB(255, 255, 0);
            DateTime dt1     = DateTime.Now;
            String   status  = jira.EndDate.ToFileTime() > dt1.ToFileTime() ? "(超时)" : "(正常)";
            GridCell cells16 = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString());

            row.AddCell("colT16", cells16);
            cells16.Tag = jira.StartDate;
            GridCell cells17 = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString());

            row.AddCell("colT17", cells17);
            cells16.Style = gridStyle16;
            cells17.Style = gridStyle16;
            cells17.Tag   = jira.EndDate;
            m_gridDgvTable.EndUpdate();
        }
Exemple #22
0
 public Chesspiece(COLOR color, int x, int y)
 {
     this.Color = color;
     this.Position = new Position(x, y);
 }
Exemple #23
0
 /// <summary>
 /// Function: OrderModify
 /// Description: Modification of characteristics of the previously opened or pending orders.
 /// URL: http://docs.mql4.com/trading/ordermodify.html
 /// </summary>
 /// <param name="ticket">[in] Unique number of the order ticket.</param>
 /// <param name="price">[in] New open price of the pending order.</param>
 /// <param name="stoploss">[in] New StopLoss level.</param>
 /// <param name="takeprofit">[in] New TakeProfit level.</param>
 /// <param name="expiration">[in] Pending order expiration time.</param>
 /// <param name="arrow_color">[in] Arrow color for StopLoss/TakeProfit modifications in the chart. If the parameter is missing or has CLR_NONE value, the arrows will not be shown in the chart.</param>
 public bool OrderModify(int ticket, double price, double stoploss, double takeprofit, DateTime expiration, COLOR arrow_color)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(ticket);
     parameters.Add(price);
     parameters.Add(stoploss);
     parameters.Add(takeprofit);
     parameters.Add(expiration);
     parameters.Add(arrow_color);
     int id = getCommandManager().ExecCommand(MQLCommand.OrderModify_1, parameters); // MQLCommand ENUM = 117
     while (getCommandManager().IsCommandRunning(id))
     {
         //Thread.Sleep(1);
     }
     getCommandManager().throwExceptionIfErrorResponse(id);
     return (bool)getCommandManager().GetCommandResult(id);
 }
 public Card(COLOR c, int count)
 {
     this.Color = c;
     this.Count = count;
 }
Exemple #25
0
 /// <summary>
 /// Function: ObjectSetText
 /// Description: The function c
 /// URL: http://docs.mql4.com/objects/objectsettext.html
 /// </summary>
 /// <param name="object_name">[in] Object name.</param>
 /// <param name="text">[in] A text describing the object.</param>
 /// <param name="font_size">[in] Font size in points.</param>
 /// <param name="font_name">[in] Font name.</param>
 /// <param name="text_color">[in] Font color.</param>
 public bool ObjectSetText(string object_name, string text, int font_size, string font_name, COLOR text_color)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(object_name);
     parameters.Add(text);
     parameters.Add(font_size);
     parameters.Add(font_name);
     parameters.Add(text_color);
     int id = getCommandManager().ExecCommand(MQLCommand.ObjectSetText_1, parameters); // MQLCommand ENUM = 194
     while (getCommandManager().IsCommandRunning(id))
     {
         //Thread.Sleep(1);
     }
     getCommandManager().throwExceptionIfErrorResponse(id);
     return (bool)getCommandManager().GetCommandResult(id);
 }
Exemple #26
0
        /// <summary>
        /// 绑定所有的群组
        /// </summary>
        private void BindGroups()
        {
            m_gridGroups.UseAnimation = true;
            List <GridRow> rows     = m_gridGroups.m_rows;
            int            rowsSize = rows.Count;

            for (int i = 0; i < rowsSize; i++)
            {
                GridRow row = rows[i];
                if (row.EditButton != null)
                {
                    m_gridGroups.RemoveControl(row.EditButton);
                    row.EditButton = null;
                }
                m_gridGroups.RemoveRow(row);
                i--;
                rowsSize--;
            }
            m_gridGroups.Update();
            GridRow firstRow = new GridRow();

            m_gridGroups.AddRow(firstRow);
            GridStringCell cell1 = new GridStringCell("");

            firstRow.AddCell("colG1", cell1);
            GridStringCell cell2 = new GridStringCell("全部");

            firstRow.AddCell("colG2", cell2);
            GridStringCell cell3 = new GridStringCell("");

            firstRow.AddCell("colG3", cell3);
            int groupsSize = m_chatGroups.Count;

            for (int i = 0; i < groupsSize; i++)
            {
                ChatGroup chatGroup = m_chatGroups[i];
                GridRow   cRow      = new GridRow();
                m_gridGroups.AddRow(cRow);
                ButtonA deleteButton = new ButtonA();
                deleteButton.Height    = cRow.Height;
                deleteButton.Name      = "btnDelete";
                deleteButton.Tag       = chatGroup.Name;
                deleteButton.BackColor = COLOR.ARGB(255, 0, 0);
                deleteButton.Native    = m_gridHosts.Native;
                deleteButton.Text      = "删除";
                cRow.EditButton        = deleteButton;
                cRow.AllowEdit         = true;
                GridStringCell cCell1 = new GridStringCell(chatGroup.Name);
                cRow.AddCell("colG1", cCell1);
                GridStringCell cCell2 = new GridStringCell(chatGroup.DisplayName);
                cRow.AddCell("colG2", cCell2);
                String strIDs      = "";
                int    userIDsSize = chatGroup.UserIDs.Count;
                for (int j = 0; j < userIDsSize; j++)
                {
                    strIDs += chatGroup.UserIDs[j];
                    if (j != userIDsSize - 1)
                    {
                        strIDs += ",";
                    }
                }
                GridStringCell cCell3 = new GridStringCell(strIDs);
                cRow.AddCell("colG3", cCell3);

                ControlMouseEvent clickButtonEvent = new ControlMouseEvent(ClickEvent);
                deleteButton.RegisterEvent(clickButtonEvent, EVENTID.CLICK);
            }
            m_gridGroups.Update();
            m_gridGroups.Invalidate();
        }
 public Vertex(int v, COLOR c)
 {
     Index = v; Color = c;
 }
Exemple #28
0
 public static extern COLORREF GetSysColor(COLOR nIndex);
Exemple #29
0
 /// <summary>
 /// Function: OrderDelete
 /// Description: Deletes previously opened pending order.
 /// URL: http://mm.l/mql4/docs.mql4.com/trading/orderdelete.html
 /// </summary>
 /// <param name="ticket">[in] Unique number of the order ticket.</param>
 /// <param name="arrow_color">[in] Color of the arrow on the chart. If the parameter is missing or has CLR_NONE value arrow will not be drawn on the chart.</param>
 public bool OrderDelete(int ticket, COLOR arrow_color)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(ticket);
     parameters.Add(arrow_color);
     MQLCommandManager.getInstance().ExecCommand(MQLCommand.OrderDelete_1, parameters); // MQLCommand ENUM = 113
     while (MQLCommandManager.getInstance().IsCommandRunning()) Thread.Sleep(1);
     return (bool) MQLCommandManager.getInstance().GetCommandResult();
 }
Exemple #30
0
 public static extern IntPtr GetSysColorBrush(COLOR nIndex);
Exemple #31
0
 public Player(COLOR argColor)
 {
     color = argColor;
 }
 /// <summary>
 /// Create a new Task in the task list
 /// </summary>
 /// <param name="title"></param>
 /// <param name="description"></param>
 /// <param name="start"></param>
 /// <param name="end"></param>
 /// <param name="status"></param>
 /// <param name="color"></param>
 /// <returns></returns>
 public bool AddToDo(string title, string description, DateTime start, DateTime end, STATUS status, COLOR color)
 {
     if (title != "")
     {
         foreach (var it in taskList)
         {
             if (it.Title == title)
             {
                 return(false);
             }
         }
         ToDo NewToDo = new ToDo(title, description, start, end, status, color);
         taskList.Add(NewToDo);
         return(true);
     }
     return(false);
 }
Exemple #33
0
 /*------------------------------------
 *  GetScore(public版)
 *
 *  summary:各スコアを取得
 *  param  :取得する色のスコア(COLOR)
 *  return :スコア(int)
 *  ------------------------------------*/
 public int GetScore(COLOR color)
 {
     return(m_score[(int)color]);
 }
Exemple #34
0
		public int this[COLOR key] 
		{
			get { return mana [key].Current; }
		}
Exemple #35
0
 /// <summary>
 /// 获取白色风格的颜色
 /// </summary>
 /// <param name="color">颜色</param>
 /// <returns>新的颜色</returns>
 public static long GetWhiteColor(long color)
 {
     if (color > CDraw.PCOLORS_USERCOLOR)
     {
         if (color == COLOR.CONTROL)
         {
             color = 16777215;
         }
         else if (color == COLOR.CONTROLBORDER)
         {
             color = 3289650;
         }
         else if (color == COLOR.CONTROLTEXT)
         {
             color = 0;
         }
         else if (color == COLOR.DISABLEDCONTROL)
         {
             color = 13158600;
         }
         else if (color == COLOR.DISABLEDCONTROLTEXT)
         {
             color = 3289650;
         }
         else if (color == COLOR.HOVEREDCONTROL)
         {
             color = 13158600;
         }
         else if (color == COLOR.PUSHEDCONTROL)
         {
             color = 9868950;
         }
     }
     else if (color == CDraw.PCOLORS_BACKCOLOR)
     {
         color = COLOR.ARGB(255, 50, 50, 50);
     }
     else if (color == CDraw.PCOLORS_BACKCOLOR2)
     {
         color = COLOR.ARGB(150, 0, 0, 0);
     }
     else if (color == CDraw.PCOLORS_BACKCOLOR3)
     {
         color = COLOR.ARGB(100, 0, 0, 0);
     }
     else if (color == CDraw.PCOLORS_BACKCOLOR4)
     {
         color = COLOR.ARGB(255, 0, 0, 0);
     }
     else if (color == CDraw.PCOLORS_BACKCOLOR5)
     {
         color = COLOR.ARGB(25, 255, 255, 255);
     }
     else if (color == CDraw.PCOLORS_BACKCOLOR6)
     {
         color = COLOR.ARGB(25, 0, 0, 0);
     }
     else if (color == CDraw.PCOLORS_BACKCOLOR7)
     {
         color = COLOR.ARGB(200, 255, 255, 255);
     }
     else if (color == CDraw.PCOLORS_FORECOLOR)
     {
         color = COLOR.ARGB(255, 255, 255);
     }
     else if (color == CDraw.PCOLORS_FORECOLOR2)
     {
         color = COLOR.ARGB(217, 217, 68);
     }
     else if (color == CDraw.PCOLORS_FORECOLOR3)
     {
         color = COLOR.ARGB(80, 255, 255);
     }
     else if (color == CDraw.PCOLORS_FORECOLOR4)
     {
         color = COLOR.ARGB(112, 112, 112);
     }
     else if (color == CDraw.PCOLORS_FORECOLOR5)
     {
         color = COLOR.ARGB(192, 192, 192);
     }
     else if (color == CDraw.PCOLORS_FORECOLOR6)
     {
         color = COLOR.ARGB(0, 0, 0);
     }
     else if (color == CDraw.PCOLORS_FORECOLOR7)
     {
         color = COLOR.ARGB(0, 255, 255);
     }
     else if (color == CDraw.PCOLORS_FORECOLOR8)
     {
         color = COLOR.ARGB(50, 50, 50);
     }
     else if (color == CDraw.PCOLORS_FORECOLOR9)
     {
         color = COLOR.ARGB(255, 255, 0);
     }
     else if (color == CDraw.PCOLORS_FORECOLOR10)
     {
         color = COLOR.ARGB(255, 255, 80);
     }
     else if (color == CDraw.PCOLORS_FORECOLOR11)
     {
         color = COLOR.ARGB(135, 206, 235);
     }
     else if (color == CDraw.PCOLORS_LINECOLOR)
     {
         color = COLOR.ARGB(255, 255, 255);
     }
     else if (color == CDraw.PCOLORS_LINECOLOR2)
     {
         color = COLOR.ARGB(217, 217, 68);
     }
     else if (color == CDraw.PCOLORS_LINECOLOR3)
     {
         color = COLOR.ARGB(0, 0, 0);
     }
     else if (color == CDraw.PCOLORS_LINECOLOR4)
     {
         color = COLOR.ARGB(255, 150, 0, 0);
     }
     else if (color == CDraw.PCOLORS_LINECOLOR5)
     {
         color = COLOR.ARGB(100, 100, 100);
     }
     else if (color == CDraw.PCOLORS_MIDCOLOR)
     {
         color = COLOR.ARGB(255, 255, 255);
     }
     else if (color == CDraw.PCOLORS_UPCOLOR)
     {
         color = COLOR.ARGB(255, 82, 82);
     }
     else if (color == CDraw.PCOLORS_DOWNCOLOR)
     {
         color = COLOR.ARGB(80, 255, 80);
     }
     else if (color == CDraw.PCOLORS_DOWNCOLOR2)
     {
         color = COLOR.ARGB(80, 255, 255);
     }
     else if (color == CDraw.PCOLORS_DOWNCOLOR3)
     {
         color = COLOR.ARGB(100, 0, 255);
     }
     else if (color == CDraw.PCOLORS_SELECTEDROWCOLOR)
     {
         color = COLOR.ARGB(150, 100, 100, 100);
     }
     else if (color == CDraw.PCOLORS_HOVEREDROWCOLOR)
     {
         color = COLOR.ARGB(150, 150, 150, 150);
     }
     else if (color == CDraw.PCOLORS_WINDOWFORECOLOR)
     {
         color = COLOR.ARGB(255, 255, 255);
     }
     else if (color == CDraw.PCOLORS_WINDOWBACKCOLOR)
     {
         color = COLOR.ARGB(255, 50, 50, 50);
     }
     else if (color == CDraw.PCOLORS_WINDOWBACKCOLOR2)
     {
         color = COLOR.ARGB(150, 0, 0, 0);
     }
     else if (color == CDraw.PCOLORS_WINDOWCONTENTBACKCOLOR)
     {
         color = COLOR.ARGB(200, 255, 255, 255);
     }
     return(color);
 }
Exemple #36
0
 public bool FillRect(ref RECT rect, COLOR color)
 {
     return FillRect(this, ref rect, (int)color + 1);
 }
Exemple #37
0
        /// <summary>
        /// 获取白色风格的颜色
        /// </summary>
        /// <param name="color">颜色</param>
        /// <returns>新的颜色</returns>
        private static long GetWhiteColor(long dwPenColor)
        {
            long color = dwPenColor;

            if (color < COLOR.EMPTY)
            {
                if (color > PCOLORS_USERCOLOR)
                {
                    if (color == COLOR.CONTROL)
                    {
                        color = COLOR.ARGB(255, 255, 255);
                    }
                    else if (color == COLOR.CONTROLBORDER)
                    {
                        color = COLOR.ARGB(200, 200, 200);
                    }
                    else if (color == COLOR.CONTROLTEXT)
                    {
                        color = COLOR.ARGB(0, 0, 0);
                    }
                    else if (color == COLOR.DISABLEDCONTROL)
                    {
                        color = COLOR.ARGB(25, 255, 255, 255);
                    }
                    else if (color == COLOR.DISABLEDCONTROLTEXT)
                    {
                        color = 3289650;
                    }
                    else if (color == COLOR.HOVEREDCONTROL)
                    {
                        color = COLOR.ARGB(150, 200, 200, 200);
                    }
                    else if (color == COLOR.PUSHEDCONTROL)
                    {
                        color = COLOR.ARGB(150, 150, 150, 150);
                    }
                }
                else if (color == PCOLORS_BACKCOLOR)
                {
                    color = COLOR.ARGB(255, 255, 255);
                }
                else if (color == PCOLORS_BACKCOLOR2)
                {
                    color = COLOR.ARGB(230, 230, 230);
                }
                else if (color == PCOLORS_BACKCOLOR3)
                {
                    color = COLOR.ARGB(25, 100, 100, 100);
                }
                else if (color == PCOLORS_BACKCOLOR4)
                {
                    color = COLOR.ARGB(25, 0, 0, 0);
                }
                else if (color == PCOLORS_BACKCOLOR5)
                {
                    color = COLOR.ARGB(75, 51, 153, 255);
                }
                else if (color == PCOLORS_BACKCOLOR6)
                {
                    color = COLOR.ARGB(50, 51, 153, 255);
                }
                else if (color == PCOLORS_BACKCOLOR7)
                {
                    color = COLOR.ARGB(100, 255, 255, 255);
                }
                else if (color == PCOLORS_BACKCOLOR8)
                {
                    color = COLOR.ARGB(50, 105, 217);
                }
                else if (color == PCOLORS_BACKCOLOR9)
                {
                    color = COLOR.ARGB(75, 215, 99);
                }
                else if (color == PCOLORS_FORECOLOR)
                {
                    color = COLOR.ARGB(0, 0, 0);
                }
                else if (color == PCOLORS_FORECOLOR2)
                {
                    color = COLOR.ARGB(112, 112, 112);
                }
                else if (color == PCOLORS_FORECOLOR3)
                {
                    color = COLOR.ARGB(100, 255, 255, 255);
                }
                else if (color == PCOLORS_FORECOLOR4)
                {
                    color = COLOR.ARGB(255, 255, 255);
                }
                else if (color == PCOLORS_LINECOLOR)
                {
                    color = COLOR.ARGB(100, 100, 100);
                }
                else if (color == PCOLORS_LINECOLOR2)
                {
                    color = COLOR.ARGB(0, 105, 217);
                }
                else if (color == CDraw.PCOLORS_UPCOLOR)
                {
                    color = COLOR.ARGB(255, 82, 82);
                }
                else if (color == CDraw.PCOLORS_DOWNCOLOR)
                {
                    color = COLOR.ARGB(80, 255, 80);
                }
                else if (color == CDraw.PCOLORS_LINECOLOR3)
                {
                    color = COLOR.ARGB(5, 255, 255, 255);
                }
                else if (color == PCOLORS_SELECTEDROWCOLOR)
                {
                    color = COLOR.ARGB(0, 105, 217);
                }
                else if (color == PCOLORS_HOVEREDROWCOLOR)
                {
                    color = COLOR.ARGB(200, 240, 240, 240);
                }
                else if (color == PCOLORS_ALTERNATEROWCOLOR)
                {
                    color = COLOR.ARGB(200, 245, 245, 245);
                }
                else if (color == CDraw.PCOLORS_WINDOWFORECOLOR)
                {
                    color = COLOR.ARGB(0, 0, 0);
                }
                else if (color == CDraw.PCOLORS_WINDOWBACKCOLOR)
                {
                    color = COLOR.ARGB(255, 255, 255);
                }
                else if (color == CDraw.PCOLORS_WINDOWBACKCOLOR2)
                {
                    color = COLOR.ARGB(100, 255, 255, 255);
                }
                else if (color == CDraw.PCOLORS_WINDOWBACKCOLOR3)
                {
                    color = COLOR.ARGB(230, 255, 255, 255);
                }
                else if (color == CDraw.PCOLORS_WINDOWCROSSLINECOLOR)
                {
                    color = COLOR.ARGB(100, 100, 100);
                }
                else if (color == CDraw.PCOLORS_WINDOWCROSSLINECOLOR2)
                {
                    color = COLOR.ARGB(10, 255, 255, 255);
                }
                else if (color == CDraw.PCOLORS_WINDOWCONTENTBACKCOLOR)
                {
                    color = COLOR.ARGB(235, 255, 255, 255);
                }
            }
            if (m_style == 2 || m_style == 3)
            {
                int a = 0, r = 0, g = 0, b = 0;
                COLOR.ToARGB(null, color, ref a, ref r, ref g, ref b);
                if (m_style == 2)
                {
                    return(COLOR.ARGB(a, (r + g + b) / 3, (r + g + b) / 3, (r + g + b) / 3));
                }
                else if (m_style == 3)
                {
                    return(COLOR.ARGB(a, 255 - r, 255 - g, 255 - b));
                }
            }
            return(color);
        }
Exemple #38
0
 /// <summary>
 /// Function: OrderModify
 /// Description: Modification of characteristics of the previously opened or pending orders.
 /// URL: http://mm.l/mql4/docs.mql4.com/trading/ordermodify.html
 /// </summary>
 /// <param name="ticket">[in] Unique number of the order ticket.</param>
 /// <param name="price">[in] New open price of the pending order.</param>
 /// <param name="stoploss">[in] New StopLoss level.</param>
 /// <param name="takeprofit">[in] New TakeProfit level.</param>
 /// <param name="expiration">[in] Pending order expiration time.</param>
 /// <param name="arrow_color">[in] Arrow color for StopLoss/TakeProfit modifications in the chart. If the parameter is missing or has CLR_NONE value, the arrows will not be shown in the chart.</param>
 public bool OrderModify(int ticket, double price, double stoploss, double takeprofit, DateTime expiration,
     COLOR arrow_color)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(ticket);
     parameters.Add(price);
     parameters.Add(stoploss);
     parameters.Add(takeprofit);
     parameters.Add(expiration);
     parameters.Add(arrow_color);
     MQLCommandManager.getInstance().ExecCommand(MQLCommand.OrderModify_1, parameters); // MQLCommand ENUM = 117
     while (MQLCommandManager.getInstance().IsCommandRunning()) Thread.Sleep(1);
     return (bool) MQLCommandManager.getInstance().GetCommandResult();
 }
Exemple #39
0
 /// <summary>
 /// Function: OrderCloseBy
 /// Description: Closes an opened order by another opposite opened order.
 /// URL: http://docs.mql4.com/trading/ordercloseby.html
 /// </summary>
 /// <param name="ticket">[in] Unique number of the order ticket.</param>
 /// <param name="opposite">[in] Unique number of the opposite order ticket.</param>
 /// <param name="arrow_color">[in] Color of the closing arrow on the chart. If the parameter is missing or has CLR_NONE value closing arrow will not be drawn on the chart.</param>
 public bool OrderCloseBy (int ticket, int opposite, COLOR arrow_color)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(ticket);
     parameters.Add(opposite);
     parameters.Add(arrow_color);
     MQLCommandManager.getInstance().ExecCommand(MQLCommand.OrderCloseBy_1, parameters); // MQLCommand ENUM = 108
     while (MQLCommandManager.getInstance().IsCommandRunning())
     {
         //Thread.Sleep(1);
     }
     MQLCommandManager.getInstance().throwExceptionIfErrorResponse();
     return (bool) MQLCommandManager.getInstance().GetCommandResult();
 }
Exemple #40
0
 protected void DrawPoint(float x, float y, COLOR color)
 {
     _Canvas.DrawPixel((int)x, (int)y, color, _GfxMode);
 }
Exemple #41
0
        /// <summary>
        /// 刷新数据
        /// </summary>
        public void Renovate()
        {
            //从服务端拿取数据
            m_jiras = XmlHandle.GetJiras();
            int count = m_jiras.Count;
            //创建Dictionary存放ID和数据
            Dictionary <String, Jira> jiraIDs = new Dictionary <String, Jira>();

            //遍历服务器的数据
            for (int i = 0; i < count; i++)
            {
                Jira jira = m_jiras[i];
                jiraIDs.Add(jira.JiraID, jira);
            }
            //获取表格所有行
            List <GridRow> rows      = m_gridDgvTable.GetRows();
            int            rowsCount = rows.Count;
            Dictionary <String, GridRow> gridRows = new Dictionary <String, GridRow>();

            //遍历表格的数据
            for (int i = 0; i < rowsCount; i++)
            {
                GridRow row = rows[i];
                //取ID
                String id = row.GetCell("colT1").Text;
                //依据ID判断
                if (!jiraIDs.ContainsKey(id))
                {
                    //ID不匹配删除行
                    m_gridDgvTable.RemoveRow(row);
                    rowsCount--;
                    i--;
                }
                else
                {
                    //匹配则加到Dictionary
                    gridRows.Add(id, row);
                }
            }
            m_gridDgvTable.Update();
            m_gridDgvTable.BeginUpdate();
            for (int i = 0; i < count; i++)
            {
                //遍历服务器数据
                Jira    jira    = m_jiras[i];
                bool    newData = false;
                String  key     = jira.JiraID;
                GridRow row;
                if (gridRows.ContainsKey(key))
                {
                    row = gridRows[key];
                }
                else
                {
                    newData = true;
                    row     = new GridRow();
                    //row.Grid = m_gridDgvTable;
                    //m_gridDgvTable.m_rows.Add(row);
                    //row.OnAdd();
                    m_gridDgvTable.AddRow(row);
                }

                //遍历columns
                List <GridColumn> columns = m_gridDgvTable.GetColumns();
                int countColumn           = columns.Count;
                for (int j = 0; j < countColumn; j++)
                {
                    GridColumn column = columns[j];
                    GridCell   cell;
                    if (newData)
                    {
                        cell = new GridCellExp();
                        row.AddCell(column.Index, cell);
                        cell.Column = column;
                    }
                    else
                    {
                        cell = row.GetCell(column.Index);
                    }
                    DateTime dt         = DateTime.Now;
                    String   status     = jira.EndDate.ToFileTime() > dt.ToFileTime() ? "(超时)" : "(正常)";
                    int      countGroup = XmlHandle.Groups.Count;
                    switch (j)
                    {
                    case 0:
                        GridCellStyle gridStyle1 = new GridCellStyle();
                        gridStyle1.BackColor = COLOR.DISABLEDCONTROL;
                        gridStyle1.ForeColor = COLOR.ARGB(255, 255, 255);
                        cell.Text            = jira.JiraID;
                        cell.Style           = gridStyle1;
                        //colT1
                        break;

                    case 1:
                        GridCellStyle gridStyle2 = new GridCellStyle();
                        gridStyle2.BackColor = COLOR.DISABLEDCONTROL;
                        gridStyle2.ForeColor = COLOR.ARGB(45, 142, 45);
                        cell.Text            = jira.Title;
                        cell.Style           = gridStyle2;
                        break;

                    case 2:
                        GridCellStyle gridStyle3 = new GridCellStyle();
                        gridStyle3.BackColor = COLOR.DISABLEDCONTROL;
                        gridStyle3.ForeColor = COLOR.ARGB(47, 145, 145);
                        cell.Text            = jira.Creater;
                        cell.Style           = gridStyle3;
                        break;

                    case 3:
                        GridCellStyle gridStyle4 = new GridCellStyle();
                        gridStyle4.BackColor = COLOR.DISABLEDCONTROL;
                        gridStyle4.ForeColor = COLOR.ARGB(47, 145, 145);;
                        cell.Style           = gridStyle4;
                        cell.Text            = jira.Developer;
                        break;

                    case 4:
                    {
                        for (int m = 0; m < countGroup; m++)
                        {
                            if (XmlHandle.Groups[m].Id == jira.GroupID)
                            {
                                GridCellStyle gridStyle5 = new GridCellStyle();
                                gridStyle5.BackColor = COLOR.DISABLEDCONTROL;
                                gridStyle5.ForeColor = COLOR.ARGB(47, 145, 145);
                                cell.Style           = gridStyle5;
                                cell.Text            = XmlHandle.Groups[m].Name;
                                break;
                            }
                        }
                        break;
                    }

                    case 5:
                    {
                        for (int m = 0; m < countGroup; m++)
                        {
                            if (XmlHandle.Groups[m].Id == jira.GroupID)
                            {
                                GridCellStyle gridStyle6 = new GridCellStyle();
                                gridStyle6.BackColor = COLOR.DISABLEDCONTROL;
                                gridStyle6.ForeColor = COLOR.ARGB(255, 153, 153);
                                cell.Style           = gridStyle6;
                                cell.Text            = XmlHandle.Groups[m].Manager;
                                break;
                            }
                        }
                        break;
                    }

                    case 6:
                    {
                        for (int m = 0; m < countGroup; m++)
                        {
                            if (XmlHandle.Groups[m].Id == jira.GroupID)
                            {
                                List <JCategory> categories = XmlHandle.Groups[m].Categories;
                                int cateCount = categories.Count;
                                for (int n = 0; n < cateCount; n++)
                                {
                                    if (categories[n].Id == jira.CategoryID)
                                    {
                                        GridCellStyle gridStyle7 = new GridCellStyle();
                                        gridStyle7.BackColor = COLOR.DISABLEDCONTROL;
                                        gridStyle7.ForeColor = COLOR.ARGB(45, 142, 45);
                                        cell.Style           = gridStyle7;
                                        cell.Text            = categories[n].Name;
                                        break;
                                    }
                                }
                                break;
                            }
                        }
                        break;
                    }

                    case 7:
                        cell.Text = jira.DeveloperReceive ? "是" : "否";
                        GridCellStyle gridStyle8 = new GridCellStyle();
                        gridStyle8.ForeColor = COLOR.ARGB(255, 255, 255);
                        if (cell.Text == "是")
                        {
                            gridStyle8.BackColor = COLOR.ARGB(93, 146, 202);
                        }
                        else
                        {
                            gridStyle8.BackColor = COLOR.ARGB(163, 5, 50);
                        }
                        cell.Style = gridStyle8;
                        break;

                    case 8:
                        cell.Text = jira.DeveloperPass ? "是" : "否";
                        GridCellStyle gridStyle9 = new GridCellStyle();
                        gridStyle9.ForeColor = COLOR.ARGB(255, 255, 255);
                        if (cell.Text == "是")
                        {
                            gridStyle9.BackColor = COLOR.ARGB(93, 146, 202);
                        }
                        else
                        {
                            gridStyle9.BackColor = COLOR.ARGB(163, 5, 50);
                        }
                        cell.Style = gridStyle9;
                        break;

                    case 9:
                        cell.Text = jira.TestPass ? "是" : "否";
                        GridCellStyle gridStyle10 = new GridCellStyle();
                        gridStyle10.ForeColor = COLOR.ARGB(255, 255, 255);
                        if (cell.Text == "是")
                        {
                            gridStyle10.BackColor = COLOR.ARGB(93, 146, 202);
                        }
                        else
                        {
                            gridStyle10.BackColor = COLOR.ARGB(163, 5, 50);
                        }
                        cell.Style = gridStyle10;
                        break;

                    case 10:
                        cell.Text = jira.ProductPass ? "是" : "否";
                        GridCellStyle gridStyle11 = new GridCellStyle();
                        gridStyle11.ForeColor = COLOR.ARGB(255, 255, 255);
                        if (cell.Text == "是")
                        {
                            gridStyle11.BackColor = COLOR.ARGB(93, 146, 202);
                        }
                        else
                        {
                            gridStyle11.BackColor = COLOR.ARGB(163, 5, 50);
                        }
                        cell.Style = gridStyle11;
                        break;

                    case 11:
                        cell.Text = jira.WaitPublish ? "是" : "否";
                        GridCellStyle gridStyle12 = new GridCellStyle();
                        gridStyle12.ForeColor = COLOR.ARGB(255, 255, 255);
                        if (cell.Text == "是")
                        {
                            gridStyle12.BackColor = COLOR.ARGB(93, 146, 202);
                        }
                        else
                        {
                            gridStyle12.BackColor = COLOR.ARGB(163, 5, 50);
                        }
                        cell.Style = gridStyle12;
                        break;

                    case 12:
                        cell.Text = jira.Published ? "是" : "否";
                        GridCellStyle gridStyle13 = new GridCellStyle();
                        gridStyle13.ForeColor = COLOR.ARGB(255, 255, 255);
                        if (cell.Text == "是")
                        {
                            gridStyle13.BackColor = COLOR.ARGB(93, 146, 202);
                        }
                        else
                        {
                            gridStyle13.BackColor = COLOR.ARGB(163, 5, 50);
                        }
                        cell.Style = gridStyle13;
                        break;

                    case 13:
                        cell.Text = jira.CloseTask ? "是" : "否";
                        GridCellStyle gridStyle14 = new GridCellStyle();
                        gridStyle14.ForeColor = COLOR.ARGB(255, 255, 255);
                        if (cell.Text == "是")
                        {
                            gridStyle14.BackColor = COLOR.ARGB(93, 146, 202);
                        }
                        else
                        {
                            gridStyle14.BackColor = COLOR.ARGB(163, 5, 50);
                        }
                        cell.Style = gridStyle14;
                        break;

                    case 14:
                        cell.Text = jira.Hurry;
                        GridCellStyle gridStyle15 = new GridCellStyle();
                        gridStyle15.BackColor = COLOR.ARGB(0, 0, 0);
                        if (cell.Text == "紧急")
                        {
                            gridStyle15.ForeColor = COLOR.ARGB(163, 5, 50);
                        }
                        else
                        {
                            gridStyle15.ForeColor = COLOR.ARGB(227, 171, 26);
                        }
                        cell.Style = gridStyle15;
                        break;

                    case 15:
                        GridCellStyle gridStyle16 = new GridCellStyle();
                        GridCell      cell16      = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString());
                        cell.Text             = cell16.Text;
                        gridStyle16.ForeColor = COLOR.ARGB(255, 255, 0);
                        cell.Style            = gridStyle16;
                        break;

                    case 16:
                        GridCellStyle gridStyle17 = new GridCellStyle();
                        GridCell      cell17      = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString());
                        cell.Text             = cell17.Text;
                        gridStyle17.ForeColor = COLOR.ARGB(255, 255, 0);
                        cell.Style            = gridStyle17;
                        break;
                    }
                }
            }

            m_gridDgvTable.EndUpdate();
            m_gridDgvTable.Invalidate();
        }
Exemple #42
0
 public Node(int val)
 {
     this.val = val;
     parent   = left = right = null;
     color    = COLOR.RED;
 }
Exemple #43
0
        /// <summary>
        /// 依据ID判断更新或者插入
        /// </summary>
        /// <param name="jira">Jira对象</param>
        public void AddOrUpdate(Jira jira)
        {
            //设置样式
            GridCellStyle gridStyle = new GridCellStyle();

            gridStyle.BackColor = COLOR.DISABLEDCONTROL;

            List <GridRow> rows = m_gridDgvTable.m_rows;
            int            size = rows.Count;

            //没有数据
            if (size <= 0)
            {
                Addrows(jira);
                return;
            }
            bool isAddRow = true;

            for (int i = 0; i < size; i++)
            {
                //GridCellStyle gridStyle = new GridCellStyle();
                //gridStyle.BackColor = COLOR.DISABLEDCONTR;
                GridRow       row        = rows[i];
                String        id         = row.GetCell("colT1").Text;
                GridCellStyle gridStyle1 = new GridCellStyle();
                gridStyle1.BackColor       = COLOR.DISABLEDCONTROL;
                gridStyle1.ForeColor       = COLOR.ARGB(255, 97, 0);
                row.GetCell("colT1").Style = gridStyle1;

                //根据ID来决定是插入还是更新
                if (id == jira.JiraID)
                {
                    isAddRow = false;
                    GridCellStyle gridStyle2 = new GridCellStyle();
                    gridStyle2.BackColor       = COLOR.DISABLEDCONTROL;
                    gridStyle2.ForeColor       = COLOR.ARGB(0, 255, 0);
                    row.GetCell("colT2").Style = gridStyle2;
                    row.GetCell("colT2").Text  = jira.Title;
                    row.GetCell("colT3").Text  = jira.Creater;
                    row.GetCell("colT4").Text  = jira.Developer;
                    int count = XmlHandle.Groups.Count;
                    for (int m = 0; m < count; m++)
                    {
                        if (XmlHandle.Groups[m].Id == jira.GroupID)
                        {
                            GridCell cell5 = new GridCellExp(XmlHandle.Groups[m].Name);
                            row.AddCell("colT5", cell5);
                            GridCell cell6 = new GridCellExp(XmlHandle.Groups[m].Manager);
                            row.AddCell("colT6", cell6);
                            List <JCategory> categories = XmlHandle.Groups[m].Categories;
                            int cateCount = categories.Count;
                            for (int n = 0; n < cateCount; n++)
                            {
                                if (categories[n].Id == jira.CategoryID)
                                {
                                    GridCell cell7 = new GridCellExp(categories[n].Name);
                                    row.AddCell("colT7", cell7);
                                    break;
                                }
                            }
                            break;
                        }
                    }
                    row.GetCell("colT8").Text  = jira.DeveloperReceive ? "是" : "否";
                    row.GetCell("colT9").Text  = jira.DeveloperPass ? "是" : "否";
                    row.GetCell("colT10").Text = jira.TestPass ? "是" : "否";
                    row.GetCell("colT11").Text = jira.ProductPass ? "是" : "否";
                    row.GetCell("colT12").Text = jira.WaitPublish ? "是" : "否";
                    row.GetCell("colT13").Text = jira.Published ? "是" : "否";
                    row.GetCell("colT14").Text = jira.CloseTask ? "是" : "否";
                    row.GetCell("colT15").Text = jira.Hurry;
                    DateTime dt     = DateTime.Now;
                    String   status = jira.EndDate.ToFileTime() > dt.ToFileTime() ? "(超时)" : "(正常)";
                    GridCell cell16 = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString());
                    row.GetCell("colT16").Text = cell16.Text;
                    GridCell cell17 = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString());
                    row.GetCell("colT17").Text = cell17.Text;
                    m_gridDgvTable.Update();
                    return;
                }
            }

            //新增
            if (isAddRow)
            {
                Addrows(jira);
                return;
            }
        }
        public static COLOR InvertFBG(COLOR color)
        {
            switch (color)
            {
            case COLOR.FG_BLACK:
                return(COLOR.BG_BLACK);

            case COLOR.FG_DARK_BLUE:
                return(COLOR.BG_DARK_GREEN);

            case COLOR.FG_DARK_GREEN:
                return(COLOR.BG_DARK_GREEN);

            case COLOR.FG_DARK_CYAN:
                return(COLOR.BG_DARK_CYAN);

            case COLOR.FG_DARK_RED:
                return(COLOR.BG_DARK_RED);

            case COLOR.FG_DARK_MAGENTA:
                return(COLOR.BG_DARK_MAGENTA);

            case COLOR.FG_DARK_YELLOW:
                return(COLOR.BG_DARK_YELLOW);

            case COLOR.FG_GREY:
                return(COLOR.BG_GREY);

            case COLOR.FG_DARK_GREY:
                return(COLOR.BG_DARK_GREY);

            case COLOR.FG_BLUE:
                return(COLOR.BG_BLUE);

            case COLOR.FG_GREEN:
                return(COLOR.BG_GREEN);

            case COLOR.FG_CYAN:
                return(COLOR.BG_CYAN);

            case COLOR.FG_RED:
                return(COLOR.BG_RED);

            case COLOR.FG_MAGENTA:
                return(COLOR.BG_MAGENTA);

            case COLOR.FG_YELLOW:
                return(COLOR.BG_YELLOW);

            case COLOR.FG_WHITE:
                return(COLOR.BG_WHITE);

            case COLOR.BG_DARK_BLUE:
                return(COLOR.FG_DARK_BLUE);

            case COLOR.BG_DARK_GREEN:
                return(COLOR.FG_DARK_GREEN);

            case COLOR.BG_DARK_CYAN:
                return(COLOR.FG_DARK_CYAN);

            case COLOR.BG_DARK_RED:
                return(COLOR.FG_DARK_RED);

            case COLOR.BG_DARK_MAGENTA:
                return(COLOR.FG_DARK_MAGENTA);

            case COLOR.BG_DARK_YELLOW:
                return(COLOR.FG_DARK_YELLOW);

            case COLOR.BG_GREY:
                return(COLOR.FG_GREY);

            case COLOR.BG_DARK_GREY:
                return(COLOR.FG_DARK_GREY);

            case COLOR.BG_BLUE:
                return(COLOR.FG_BLUE);

            case COLOR.BG_GREEN:
                return(COLOR.FG_GREEN);

            case COLOR.BG_CYAN:
                return(COLOR.FG_CYAN);

            case COLOR.BG_RED:
                return(COLOR.FG_RED);

            case COLOR.BG_MAGENTA:
                return(COLOR.BG_MAGENTA);

            case COLOR.BG_YELLOW:
                return(COLOR.FG_YELLOW);

            case COLOR.BG_WHITE:
                return(COLOR.FG_WHITE);

            default:
                return(COLOR.FG_BLACK);
            }
        }
Exemple #45
0
 /// <summary>
 /// Function: OrderDelete
 /// Description: Deletes previously opened pending order.
 /// URL: http://docs.mql4.com/trading/orderdelete.html
 /// </summary>
 /// <param name="ticket">[in] Unique number of the order ticket.</param>
 /// <param name="arrow_color">[in] Color of the arrow on the chart. If the parameter is missing or has CLR_NONE value arrow will not be drawn on the chart.</param>
 public bool OrderDelete(int ticket, COLOR arrow_color)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(ticket);
     parameters.Add(arrow_color);
     int id = getCommandManager().ExecCommand(MQLCommand.OrderDelete_1, parameters); // MQLCommand ENUM = 113
     while (getCommandManager().IsCommandRunning(id))
     {
         //Thread.Sleep(1);
     }
     getCommandManager().throwExceptionIfErrorResponse(id);
     return (bool)getCommandManager().GetCommandResult(id);
 }
        public static void GetConsoleColor(this Color color, out Character ch, out COLOR cl)
        {
            ch = Character.Null;
            cl = COLOR.BG_BLACK;

            float satur = color.GetSaturation();
            float light = color.GetBrightness();
            float hue   = color.GetHue();

            if (satur <0.1f | light> 0.8f)
            {
                ch = Character.Full;
                cl = COLOR.BG_BLACK;

                ch = light < 0.2 ? Character.Light : light < 0.5 ? Character.Medium : light < 0.8 ? Character.Dark : Character.Full;

                if (light == 0)
                {
                    cl = COLOR.FG_BLACK | COLOR.BG_BLACK;
                    ch = Character.Medium;
                }
                else if (light <= 0.1)
                {
                    cl = COLOR.FG_DARK_GREY | COLOR.BG_BLACK;
                    ch = Character.Medium;
                }
                else if (light <= 0.3)
                {
                    cl = COLOR.FG_DARK_GREY;
                    ch = Character.Full;
                }
                else if (light <= 0.5)
                {
                    cl = COLOR.FG_DARK_GREY | COLOR.BG_GREY;
                    ch = Character.Medium;
                }
                else if (light <= 0.6)
                {
                    cl = COLOR.FG_GREY;
                    ch = Character.Full;
                }
                else if (light <= 0.8)
                {
                    cl = COLOR.FG_GREY | COLOR.BG_WHITE;
                    ch = Character.Medium;
                }
                else
                {
                    cl = COLOR.FG_WHITE;
                    ch = Character.Full;
                }
            }
            else
            {
                if (hue <= 10)
                {
                    if (light <= 0.4)
                    {
                        cl = COLOR.FG_DARK_RED;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.5)
                    {
                        cl = COLOR.FG_RED;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.7)
                    {
                        cl = COLOR.FG_RED | COLOR.BG_WHITE;
                        ch = Character.Medium;
                    }
                    else
                    {
                        cl = COLOR.FG_RED | COLOR.BG_WHITE;
                        ch = Character.Light;
                    }
                }
                else if (hue <= 30)
                {
                    if (light <= 0.3)
                    {
                        cl = COLOR.FG_DARK_RED | COLOR.BG_YELLOW;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.4)
                    {
                        cl = COLOR.FG_DARK_RED | COLOR.BG_YELLOW;
                        ch = Character.Medium;
                    }
                    else if (light <= 0.5)
                    {
                        cl = COLOR.FG_RED | COLOR.BG_YELLOW;
                        ch = Character.Medium;
                    }
                    else if (light <= 0.7)
                    {
                        cl = COLOR.FG_RED | COLOR.BG_WHITE;
                        ch = Character.Medium;
                    }
                    else
                    {
                        cl = COLOR.FG_RED | COLOR.BG_WHITE;
                        ch = Character.Light;
                    }
                }
                else if (hue <= 45)
                {
                    if (light <= 0.3)
                    {
                        cl = COLOR.FG_YELLOW | COLOR.BG_DARK_RED;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.6)
                    {
                        cl = COLOR.FG_YELLOW | COLOR.BG_RED;
                        ch = Character.Medium;
                    }
                    else if (light <= 0.7)
                    {
                        cl = COLOR.FG_YELLOW | COLOR.BG_RED;
                        ch = Character.Light;
                    }
                    else
                    {
                        cl = COLOR.FG_YELLOW | COLOR.BG_RED;
                        ch = Character.Light;
                    }
                }
                else if (hue <= 65)
                {
                    if (light <= 0.4)
                    {
                        cl = COLOR.FG_DARK_YELLOW;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.5)
                    {
                        cl = COLOR.FG_YELLOW;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.6)
                    {
                        cl = COLOR.FG_YELLOW | COLOR.BG_YELLOW;
                        ch = Character.Light;
                    }
                    else
                    {
                        cl = COLOR.FG_YELLOW | COLOR.BG_WHITE;
                        ch = Character.Light;
                    }
                }
                else if (hue <= 96)
                {
                    if (light <= 0.3)
                    {
                        cl = COLOR.FG_DARK_GREEN | COLOR.BG_DARK_YELLOW;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.5)
                    {
                        cl = COLOR.FG_DARK_GREEN | COLOR.BG_DARK_YELLOW;
                        ch = Character.Medium;
                    }
                    else if (light <= 0.6)
                    {
                        cl = COLOR.FG_GREEN | COLOR.BG_YELLOW;
                        ch = Character.Medium;
                    }
                    else if (light <= 0.7)
                    {
                        cl = COLOR.FG_GREEN | COLOR.BG_YELLOW;
                        ch = Character.Light;
                    }
                    else
                    {
                        cl = COLOR.FG_GREEN | COLOR.BG_WHITE;
                        ch = Character.Light;
                    }
                }
                else if (hue <= 150)
                {
                    if (light <= 0.3)
                    {
                        cl = COLOR.FG_DARK_GREEN;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.5)
                    {
                        cl = COLOR.FG_DARK_GREEN;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.7)
                    {
                        cl = COLOR.FG_GREEN;
                        ch = Character.Dark;
                    }
                    else
                    {
                        cl = COLOR.FG_GREEN | COLOR.BG_WHITE;
                        ch = Character.Light;
                    }
                }
                else if (hue <= 150)
                {
                    if (light <= 0.3)
                    {
                        cl = COLOR.FG_DARK_CYAN | COLOR.BG_DARK_GREEN;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.5)
                    {
                        cl = COLOR.FG_DARK_CYAN | COLOR.BG_DARK_GREEN;
                        ch = Character.Medium;
                    }
                    else if (light <= 0.6)
                    {
                        cl = COLOR.FG_CYAN | COLOR.BG_GREEN;
                        ch = Character.Medium;
                    }
                    else if (light <= 0.7)
                    {
                        cl = COLOR.FG_CYAN | COLOR.BG_GREEN;
                        ch = Character.Light;
                    }
                    else
                    {
                        cl = COLOR.FG_CYAN | COLOR.BG_WHITE;
                        ch = Character.Light;
                    }
                }
                else if (hue <= 190)
                {
                    if (light <= 0.3)
                    {
                        cl = COLOR.FG_DARK_CYAN;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.5)
                    {
                        cl = COLOR.FG_DARK_CYAN;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.7)
                    {
                        cl = COLOR.FG_CYAN;
                        ch = Character.Dark;
                    }
                    else
                    {
                        cl = COLOR.FG_CYAN | COLOR.BG_WHITE;
                        ch = Character.Light;
                    }
                }
                else if (hue <= 220)
                {
                    if (light <= 0.3)
                    {
                        cl = COLOR.FG_DARK_CYAN | COLOR.BG_DARK_BLUE;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.5)
                    {
                        cl = COLOR.FG_DARK_CYAN | COLOR.BG_DARK_BLUE;
                        ch = Character.Medium;
                    }
                    else if (light <= 0.7)
                    {
                        cl = COLOR.FG_CYAN | COLOR.BG_BLUE;
                        ch = Character.Medium;
                    }
                    else
                    {
                        cl = COLOR.FG_CYAN | COLOR.BG_WHITE;
                        ch = Character.Light;
                    }
                }
                else if (hue <= 240)
                {
                    if (light <= 0.3)
                    {
                        cl = COLOR.FG_DARK_BLUE;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.5)
                    {
                        cl = COLOR.FG_DARK_BLUE;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.7)
                    {
                        cl = COLOR.FG_BLUE;
                        ch = Character.Dark;
                    }
                    else
                    {
                        cl = COLOR.FG_BLUE | COLOR.BG_WHITE;
                        ch = Character.Light;
                    }
                }
                else if (hue <= 275)
                {
                    if (light <= 0.3)
                    {
                        cl = COLOR.FG_DARK_BLUE | COLOR.BG_DARK_MAGENTA;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.5)
                    {
                        cl = COLOR.FG_DARK_BLUE | COLOR.BG_DARK_MAGENTA;
                        ch = Character.Medium;
                    }
                    else if (light <= 0.6)
                    {
                        cl = COLOR.FG_BLUE | COLOR.BG_MAGENTA;
                        ch = Character.Medium;
                    }
                    else if (light <= 0.7)
                    {
                        cl = COLOR.FG_BLUE | COLOR.BG_MAGENTA;
                        ch = Character.Light;
                    }
                    else
                    {
                        cl = COLOR.FG_BLUE | COLOR.BG_WHITE;
                        ch = Character.Light;
                    }
                }
                else if (hue <= 320)
                {
                    if (light <= 0.3)
                    {
                        cl = COLOR.FG_DARK_MAGENTA;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.5)
                    {
                        cl = COLOR.FG_DARK_MAGENTA;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.7)
                    {
                        cl = COLOR.FG_MAGENTA;
                        ch = Character.Dark;
                    }
                    else
                    {
                        cl = COLOR.FG_MAGENTA | COLOR.BG_WHITE;
                        ch = Character.Light;
                    }
                }
                else
                {
                    if (light <= 0.3)
                    {
                        cl = COLOR.FG_DARK_MAGENTA | COLOR.BG_DARK_RED;
                        ch = Character.Dark;
                    }
                    else if (light <= 0.5)
                    {
                        cl = COLOR.FG_DARK_MAGENTA | COLOR.BG_DARK_RED;
                        ch = Character.Medium;
                    }
                    else if (light <= 0.6)
                    {
                        cl = COLOR.FG_MAGENTA | COLOR.BG_RED;
                        ch = Character.Medium;
                    }
                    else if (light <= 0.7)
                    {
                        cl = COLOR.FG_MAGENTA | COLOR.BG_RED;
                        ch = Character.Light;
                    }
                    else
                    {
                        cl = COLOR.FG_MAGENTA | COLOR.BG_WHITE;
                        ch = Character.Light;
                    }
                }
            }
        }
Exemple #47
0
 /// <summary>
 /// Function: OrderSend
 /// Description: The main function used to open market or place a pending order.
 /// URL: http://docs.mql4.com/trading/ordersend.html
 /// </summary>
 /// <param name="symbol">[in] Symbol for trading.</param>
 /// <param name="cmd">[in] Operation type. It can be any of the enumeration.</param>
 /// <param name="volume">[in] Number of lots.</param>
 /// <param name="price">[in] Order price.</param>
 /// <param name="slippage">[in] Maximum price slippage for buy or sell orders.</param>
 /// <param name="stoploss">[in] Stop loss level.</param>
 /// <param name="takeprofit">[in] Take profit level.</param>
 /// <param name="comment">[in] Order comment text. Last part of the comment may be changed by server.</param>
 /// <param name="magic">[in] Order magic number. May be used as user defined identifier.</param>
 /// <param name="expiration">[in] Order expiration time (for pending orders only).</param>
 /// <param name="arrow_color">[in] Color of the opening arrow on the chart. If parameter is missing or has CLR_NONE value opening arrow is not drawn on the chart.</param>
 public int OrderSend(string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment, int magic, DateTime expiration, COLOR arrow_color)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(symbol);
     parameters.Add(cmd);
     parameters.Add(volume);
     parameters.Add(price);
     parameters.Add(slippage);
     parameters.Add(stoploss);
     parameters.Add(takeprofit);
     parameters.Add(comment);
     parameters.Add(magic);
     parameters.Add(expiration);
     parameters.Add(arrow_color);
     int id = getCommandManager().ExecCommand(MQLCommand.OrderSend_1, parameters); // MQLCommand ENUM = 123
     while (getCommandManager().IsCommandRunning(id))
     {
         //Thread.Sleep(1);
     }
     getCommandManager().throwExceptionIfErrorResponse(id);
     return (int)getCommandManager().GetCommandResult(id);
 }
        public static void CombineTwoColors(COLOR one, COLOR two, float mix, out Character ch, out COLOR cl)
        {
            ch = Character.Null;
            cl = COLOR.BG_BLACK;

            if (mix < 0.05f)
            {
                //full
                ch = Character.Full;
                cl = one | InvertFBG(two);
            }
            else if (mix < 0.4f)
            {
                //dark
                ch = Character.Dark;
                cl = one | InvertFBG(two);
            }
            else if (mix < 0.6f)
            {
                //medium
                ch = Character.Medium;
                cl = one | InvertFBG(two);
            }
            else if (mix <= 0.95f)
            {
                //dark
                ch = Character.Dark;
                cl = two | InvertFBG(one);
            }
            else
            {
                //full
                ch = Character.Full;
                cl = two | InvertFBG(one);
            }
        }
Exemple #49
0
 /// <summary>
 /// Function: SetLevelStyle
 /// Description: The function sets a new style, width and color of horizontal levels of indicator to be output in a separate window.
 /// URL: http://docs.mql4.com/customind/setlevelstyle.html
 /// </summary>
 /// <param name="draw_style">[in] Drawing style. Can be one of the listed. EMPTY value means that the style will not be changed.</param>
 /// <param name="line_width">[in] Line width. Valid values are 1,2,3,4,5. EMPTY value indicates that the width will not be changed.</param>
 /// <param name="clr">[in] Line color. Empty value CLR_NONE means that the color will not be changed.</param>
 public void SetLevelStyle(int draw_style, int line_width, COLOR clr)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(draw_style);
     parameters.Add(line_width);
     parameters.Add(clr);
     int id = getCommandManager().ExecCommand(MQLCommand.SetLevelStyle_1, parameters); // MQLCommand ENUM = 169
     while (getCommandManager().IsCommandRunning(id))
     {
         //Thread.Sleep(1);
     }
     getCommandManager().throwExceptionIfErrorResponse(id);
 }
Exemple #50
0
 public void setColor(COLOR argColor)
 {
     color = argColor;
 }
Exemple #51
0
 public Round(COLOR color)
 {
     this.color = color;
 }
Exemple #52
0
        /// <summary>
        /// 获取白色风格的颜色
        /// </summary>
        /// <param name="color">颜色</param>
        /// <returns>新的颜色</returns>
        public static long GetWhiteColor(long dwPenColor)
        {
            long color = dwPenColor;

            if (color < COLOR.EMPTY)
            {
                if (color > PCOLORS_USERCOLOR)
                {
                    if (color == COLOR.CONTROL)
                    {
                        color = COLOR.ARGB(255, 255, 255);
                    }
                    else if (color == COLOR.CONTROLBORDER)
                    {
                        color = COLOR.ARGB(200, 200, 200);
                    }
                    else if (color == COLOR.CONTROLTEXT)
                    {
                        color = COLOR.ARGB(0, 0, 0);
                    }
                    else if (color == COLOR.DISABLEDCONTROL)
                    {
                        color = COLOR.ARGB(25, 255, 255, 255);
                    }
                    else if (color == COLOR.DISABLEDCONTROLTEXT)
                    {
                        color = 3289650;
                    }
                    else if (color == COLOR.HOVEREDCONTROL)
                    {
                        color = COLOR.ARGB(150, 200, 200, 200);
                    }
                    else if (color == COLOR.PUSHEDCONTROL)
                    {
                        color = COLOR.ARGB(150, 150, 150, 150);
                    }
                }
                else if (color == PCOLORS_BACKCOLOR)
                {
                    color = COLOR.ARGB(255, 255, 255);
                }
                else if (color == PCOLORS_BACKCOLOR2)
                {
                    color = COLOR.ARGB(230, 230, 230);
                }
                else if (color == PCOLORS_BACKCOLOR3)
                {
                    color = COLOR.ARGB(25, 200, 200, 200);
                }
                else if (color == PCOLORS_BACKCOLOR4)
                {
                    color = COLOR.ARGB(25, 100, 100, 100);
                }
                else if (color == PCOLORS_BACKCOLOR5)
                {
                    color = COLOR.ARGB(75, 51, 153, 255);
                }
                else if (color == PCOLORS_BACKCOLOR6)
                {
                    color = COLOR.ARGB(50, 51, 153, 255);
                }
                else if (color == PCOLORS_BACKCOLOR7)
                {
                    color = COLOR.ARGB(100, 255, 255, 255);
                }
                else if (color == PCOLORS_BACKCOLOR8)
                {
                    color = COLOR.ARGB(50, 105, 217);
                }
                else if (color == PCOLORS_BACKCOLOR9)
                {
                    color = COLOR.ARGB(75, 215, 99);
                }
                else if (color == PCOLORS_BACKCOLOR10)
                {
                    color = COLOR.ARGB(186, 85, 211);
                }
                else if (color == PCOLORS_BACKCOLOR11)
                {
                    color = COLOR.ARGB(160, 82, 45);
                }
                else if (color == PCOLORS_BACKCOLOR12)
                {
                    color = COLOR.ARGB(255, 105, 180);
                }
                else if (color == PCOLORS_FORECOLOR)
                {
                    color = COLOR.ARGB(0, 0, 0);
                }
                else if (color == PCOLORS_FORECOLOR2)
                {
                    color = COLOR.ARGB(112, 112, 112);
                }
                else if (color == PCOLORS_FORECOLOR3)
                {
                    color = COLOR.ARGB(100, 255, 255, 255);
                }
                else if (color == PCOLORS_FORECOLOR4)
                {
                    color = COLOR.ARGB(255, 255, 255);
                }
                else if (color == PCOLORS_LINECOLOR)
                {
                    color = COLOR.ARGB(100, 100, 100);
                }
                else if (color == PCOLORS_LINECOLOR2)
                {
                    color = COLOR.ARGB(0, 105, 217);
                }
                else if (color == CDraw.PCOLORS_UPCOLOR)
                {
                    color = COLOR.ARGB(255, 82, 82);
                }
                else if (color == CDraw.PCOLORS_DOWNCOLOR)
                {
                    color = COLOR.ARGB(80, 255, 80);
                }
                else if (color == CDraw.PCOLORS_DOWNCOLOR3)
                {
                    color = COLOR.ARGB(100, 0, 255);
                }
                else if (color == CDraw.PCOLORS_LINECOLOR3)
                {
                    color = COLOR.ARGB(5, 255, 255, 255);
                }
                else if (color == PCOLORS_SELECTEDROWCOLOR)
                {
                    color = COLOR.ARGB(0, 105, 217);
                }
                else if (color == PCOLORS_HOVEREDROWCOLOR)
                {
                    color = COLOR.ARGB(240, 240, 240);
                }
                else if (color == PCOLORS_ALTERNATEROWCOLOR)
                {
                    color = COLOR.ARGB(245, 245, 245);
                }
                else if (color == CDraw.PCOLORS_WINDOWFORECOLOR)
                {
                    color = COLOR.ARGB(0, 0, 0);
                }
                else if (color == CDraw.PCOLORS_WINDOWBACKCOLOR)
                {
                    color = COLOR.ARGB(255, 255, 255);
                }
                else if (color == CDraw.PCOLORS_WINDOWBACKCOLOR2)
                {
                    color = COLOR.ARGB(100, 255, 255, 255);
                }
                else if (color == CDraw.PCOLORS_WINDOWBACKCOLOR3)
                {
                    color = COLOR.ARGB(230, 255, 255, 255);
                }
                else if (color == CDraw.PCOLORS_WINDOWCROSSLINECOLOR)
                {
                    color = COLOR.ARGB(100, 100, 100);
                }
                else if (color == CDraw.PCOLORS_WINDOWCROSSLINECOLOR2)
                {
                    color = COLOR.ARGB(10, 255, 255, 255);
                }
                else if (color == CDraw.PCOLORS_WINDOWCONTENTBACKCOLOR)
                {
                    color = COLOR.ARGB(235, 255, 255, 255);
                }
            }
            return(color);
        }
Exemple #53
0
    /**
     * @brief 패킷 분석
     */
    public void ParsePacket(int len)
    {
        string msg = Encoding.UTF8.GetString(this.buf, 2, len - 2);

        string[] txt = msg.Split(':');

        // 접속 - 첫 로그인
        if (txt[0].Equals("CONNECT"))
        {
            Debug.Log("Connected.");
            SendMsg(string.Format("LOGIN:{0}", nickName));
            profileNickname.text = nickName;
        }
        // 방에 있던 사람 중 누군가 나감
        else if (txt[0].Equals("SOMEONE_EXIT"))
        {
            if (uniqueNumber.Equals(int.Parse(txt[1])))
            {
                v_user.Clear();
                return;
            }

            int i;
            for (i = 0; i < v_user.Count; i++)
            {
                if (v_user[i].uniqueNumber.Equals(int.Parse(txt[1])))
                {
                    break;
                }
            }
            v_user.RemoveAt(i);

            _roomGM.roomRefresh();
        }
        // 게임 도중 방에 있던 사람 중 누군가 나감 SOMEONE_EXIT 와는 상황이 조금 다름
        else if (txt[0].Equals("LOGOUT"))
        {
            Debug.Log("COME IN LOGOUT");

            if (v_user.Count == 0)
            {
                return;
            }

            int i;
            for (i = 0; i < v_user.Count; i++)
            {
                if (v_user[i].uniqueNumber.Equals(int.Parse(txt[1])))
                {
                    break;
                }
            }

            Debug.Log("LOGOUT " + i);
            Debug.Log("USER MAX " + v_user.Count);

            v_user.RemoveAt(i);

            _roomGM.roomRefresh();
        }
        else if (txt[0].Equals("GAME_START"))
        {
            Debug.Log(msg);

            //uniqueNumber = int.Parse(txt[1]);

            Debug.Log("GAME START !!!");
            _soundGM.waitBGM();
            Debug.Log("txt 메세지 사이즈 (2개 + 3*인원수 여야됨) : " + txt.Length);

            // 1: 고유번호, 2: 첫 시작 위치
            for (int k = 0; k < (txt.Length - 1) / 2; k++)
            {
                for (int j = 0; j < v_user.Count; j++)
                {
                    if (v_user[j].uniqueNumber == int.Parse(txt[1 + k * 2]))
                    {
                        UserInfo info = v_user[j];
                        info.startPos = int.Parse(txt[2 + k * 2]);
                        v_user[j]     = info;
                        break;
                    }
                }
            }

            firstPlayerUniqueNumber = int.Parse(txt[1]);
            SceneManager.LoadScene("InGame");
        }
        else if (txt[0].Equals("TURN"))
        {
            GameMng.I.turnManage(int.Parse(txt[1]));
        }
        else if (txt[0].Equals("DESTROY_BUILT"))
        {
            GameMng.I._BuiltGM.DestroyBuilt(int.Parse(txt[1]), int.Parse(txt[2]));
        }
        // 직접 방 생성후 이동
        else if (txt[0].Equals("CHANGE_ROOM"))
        {
            myRoom = int.Parse(txt[1]);
            // 광장이 아닐때
            if (!myRoom.Equals(0))
            {
                _roomGM.changeRoom();
            }
        }
        // 방 정보 받음
        else if (txt[0].Equals("FOUND_ROOM"))
        {
            _roomGM.makeGate(txt[1], txt[2], txt[3], txt[4], txt[5]);
        }
        // 방에 접속 시도후 받음
        else if (txt[0].Equals("ENTER_ROOM"))
        {
            if (txt[1].Equals("IN"))
            {
                for (int k = 0; k < (txt.Length - 2) / 4; k++)
                {
                    UserInfo userInfo = new UserInfo
                    {
                        nickName     = txt[3 + k * 4],
                        uniqueNumber = int.Parse(txt[4 + k * 4]),
                        tribe        = int.Parse(txt[5 + k * 4]),
                        color        = int.Parse(txt[6 + k * 4])
                    };
                    v_user.Add(userInfo);

                    if (uniqueNumber.Equals(int.Parse(txt[4 + k * 4])))
                    {
                        myColor = (COLOR)(int.Parse(txt[6 + k * 4]));
                    }
                }
                _roomGM.intoRoom(txt[2]);
                _roomGM.roomRefresh();
            }
            else if (txt[1].Equals("LIMIT"))
            {
                myRoom = 0;
            }
            else if (txt[1].Equals("MISS"))
            {
                myRoom = 0;
            }
        }
        else if (txt[0].Equals("CREATE_UNIT"))
        {
            // x값, y값, 유닛 코드, 생성자, 건물 x값, 건물 y값
            GameMng.I._BuiltGM.CreateUnit(int.Parse(txt[1]), int.Parse(txt[2]), int.Parse(txt[3]), int.Parse(txt[4]), int.Parse(txt[5]), int.Parse(txt[6]));
        }
        else if (txt[0].Equals("CREATE_BUILT"))
        {
            // x값, y값, 건물 코드, 생성자, 건물 x값, 건물 y값
            GameMng.I._UnitGM.CreateBuilt(int.Parse(txt[1]), int.Parse(txt[2]), int.Parse(txt[3]), int.Parse(txt[4]), int.Parse(txt[5]), int.Parse(txt[6]));
        }
        else if (txt[0].Equals("MOVE_UNIT"))
        {
            // 현재 x값, y값, 이동할 x값, y값
            StartCoroutine(GameMng.I._UnitGM.MovingUnit(int.Parse(txt[1]), int.Parse(txt[2]), int.Parse(txt[3]), int.Parse(txt[4])));
        }
        else if (txt[0].Equals("ATTACK"))
        {
            // 오브젝트 x값, y값, 공격할 x값, y값
            // 현재 오브젝트를 찾아서 공격력 찾은 다음 대상 위치의 hp 를 깎음
            GameMng.I.attack(int.Parse(txt[1]), int.Parse(txt[2]), int.Parse(txt[3]), int.Parse(txt[4]), int.Parse(txt[5]));
        }
        else if (txt[0].Equals("LOSE"))
        {
            // Tab UI 에서 죽은 유저로 표시하기
            GameMng.I.UserExit(int.Parse(txt[1]));
        }
        else if (txt[0].Equals("PLUNDER"))
        {
            Debug.Log(txt[1] + "," + txt[2] + "," + txt[3] + "," + txt[4]);
            // 공격한 사람 고유번호, 공격당한 사람 고유번호, 약달한 골드
            switch (int.Parse(txt[1]))
            {
            case 0:
                if (uniqueNumber.Equals(int.Parse(txt[1])))
                {
                    GameMng.I.addGold(int.Parse(txt[3]));
                }
                else if (uniqueNumber.Equals(int.Parse(txt[2])))
                {
                    GameMng.I.minGold(int.Parse(txt[3]));
                }
                break;

            case 1:
                if (uniqueNumber.Equals(int.Parse(txt[1])))
                {
                    GameMng.I.addFood(int.Parse(txt[3]));
                }
                else if (uniqueNumber.Equals(int.Parse(txt[2])))
                {
                    GameMng.I.minFood(int.Parse(txt[3]));
                }
                break;
            }
        }
        else if (txt[0].Equals("TRIBE"))
        {
            // 종족을 변경하는 유저의 코드와 변경하는 종족의 코드
            _roomGM.changeTribe(int.Parse(txt[1]), int.Parse(txt[2]));
        }
        else if (txt[0].Equals("COLOR"))
        {
            // 색상을 변경하는 유저의 코드와 변경하는 색상의 코드
            _roomGM.changeColor(int.Parse(txt[1]), int.Parse(txt[2]));
        }
        else if (txt[0].Equals("UNIQUE"))
        {
            uniqueNumber = int.Parse(txt[1]);
        }
        else if (txt[0].Equals("SELECTING"))
        {
            if (!GameMng.I.myTurn)
            {
                GameMng.I.enemyClickTile(int.Parse(txt[1]), int.Parse(txt[2]));
            }
        }
        else if (txt[0].Equals("CHAT"))
        {
            GameMng.I._chat.newMessage(txt[1], txt[2]);
        }
        // 누군가 들어올때 받음
        else if (txt[0].Equals("SOMEONE_ENTER"))
        {
            UserInfo tempUser = new UserInfo
            {
                nickName     = txt[1],
                uniqueNumber = int.Parse(txt[2]),
                tribe        = int.Parse(txt[3]),
                color        = int.Parse(txt[4])
            };
            v_user.Add(tempUser);
            _roomGM.roomRefresh();
        }
    }
Exemple #54
0
 /// <summary>
 /// 重绘背景方法
 /// </summary>
 /// <param name="paint">绘图对象</param>
 public void OnPaintBackground(CPaint paint)
 {
     if (m_k != 0 && m_b != 0)
     {
         if (IsClick)
         {
             int a = 0, r = 0, g = 0, b = 0;
             COLOR.ToARGB(paint, m_backColor, ref a, ref r, ref g, ref b);
             RECT bRect = new RECT(m_location.x - m_tick3, m_location.y - m_tick3, m_location.x + m_tick3, m_location.y + m_tick3);
             if (m_tick3 < 400)
             {
                 paint.FillEllipse(COLOR.ARGB(200 - 200 * m_tick3 / 400, r, g, b), bRect);
             }
             paint.DrawEllipse(m_backColor, 2, 0, bRect);
             m_tick3 += 40;
             bRect    = new RECT(m_location.x - m_tick4, m_location.y - m_tick4, m_location.x + m_tick4, m_location.y + m_tick4);
             if (m_tick4 < 300)
             {
                 paint.FillEllipse(COLOR.ARGB(150 - 150 * m_tick4 / 400, r, g, b), bRect);
             }
             m_tick4 += 20;
             bRect    = new RECT(m_location.x - m_tick5, m_location.y - m_tick5, m_location.x + m_tick5, m_location.y + m_tick5);
             if (m_tick5 < 200)
             {
                 paint.FillEllipse(COLOR.ARGB(100 - 100 * m_tick5 / 400, r, g, b), bRect);
             }
             m_tick5 += 10;
         }
         else
         {
             RECT drawRect = new RECT(m_location.x - m_tick, m_location.y - m_tick, m_location.x + m_tick, m_location.y + m_tick);
             paint.FillGradientEllipse(m_backColor, COLOR.RatioColor(paint, m_backColor, 1.1), drawRect, 90);
             paint.DrawEllipse(m_backColor, 2, 0, new RECT(m_location.x - 20, m_location.y - 20, m_location.x + 20, m_location.y + 20));
         }
         if (m_tick2 % 5 == 0)
         {
             if (m_mode == 0)
             {
                 m_tick++;
                 if (m_tick > 10)
                 {
                     m_mode = 1;
                 }
             }
             else if (m_mode == 1)
             {
                 m_tick--;
                 if (m_tick < 4)
                 {
                     m_mode = 0;
                 }
             }
         }
         m_tick2++;
         if (m_tick2 > 1000)
         {
             m_tick2 = 0;
         }
         if (m_security != null)
         {
             SecurityLatestData latestData = new SecurityLatestData();
             if (SecurityService.GetLatestData(m_security.m_code, ref latestData) == 0)
             {
                 latestData.m_securityName = m_security.m_name;
             }
             if (IsClick)
             {
                 FONT   nFont = new FONT("Arial", 30, true, false, false);
                 FONT   iFont = new FONT("SimSum", 30, true, false, false);
                 String name  = m_security.m_name;
                 SIZE   tSize = paint.TextSize(name, iFont);
                 int    x     = m_location.x - tSize.cx / 2;
                 int    mid   = x + tSize.cx / 2;
                 int    y     = m_location.y - 90;
                 RECT   tRect = new RECT(x, y, x + tSize.cx, y + tSize.cy);
                 paint.DrawText(name, m_backColor, iFont, tRect);
                 double diff = 0;
                 if (latestData.m_lastClose > 0)
                 {
                     diff = 100 * (latestData.m_close - latestData.m_lastClose) / latestData.m_lastClose;
                 }
                 y += tSize.cy;
                 String strClose = latestData.m_close.ToString();
                 tSize = paint.TextSize(strClose, nFont);
                 x     = mid - tSize.cx / 2;
                 tRect = new RECT(x, y, x + tSize.cx, y + tSize.cy);
                 if (diff >= 0)
                 {
                     paint.DrawText(strClose, COLOR.ARGB(255, 82, 82), nFont, tRect);
                 }
                 else
                 {
                     paint.DrawText(strClose, COLOR.ARGB(82, 255, 82), nFont, tRect);
                 }
                 y += tSize.cy;
                 String value = diff.ToString("0.00") + "%";
                 if (diff >= 0)
                 {
                     value = "+" + value;
                 }
                 if (latestData.m_close == 0)
                 {
                     value = "停牌";
                 }
                 tSize = paint.TextSize(value, nFont);
                 x     = mid - tSize.cx / 2;
                 tRect = new RECT(x, y, x + tSize.cx, y + tSize.cy);
                 if (diff >= 0)
                 {
                     paint.DrawText(value, COLOR.ARGB(255, 82, 82), nFont, tRect);
                 }
                 else
                 {
                     paint.DrawText(value, COLOR.ARGB(82, 255, 82), nFont, tRect);
                 }
                 y += tSize.cy;
                 double volume = latestData.m_volume / 100;
                 String unit   = "";
                 if (volume > 100000000)
                 {
                     volume /= 100000000;
                     unit    = "亿";
                 }
                 else if (volume > 10000)
                 {
                     volume /= 10000;
                     unit    = "万";
                 }
                 String strVol = (volume).ToString("0.00") + unit;
                 tSize = paint.TextSize(strVol, nFont);
                 x     = mid - tSize.cx / 2;
                 tRect = new RECT(x, y, x + tSize.cx, y + tSize.cy);
                 paint.DrawText(strVol, COLOR.ARGB(255, 255, 0), nFont, tRect);
             }
             else
             {
                 FONT   iFont = new FONT("SimSum", 30, true, false, false);
                 String name  = m_security.m_name;
                 SIZE   tSize = paint.TextSize(name, iFont);
                 int    x     = m_location.x - tSize.cx / 2;
                 int    mid   = x + tSize.cx / 2;
                 int    y     = m_location.y - 60;
                 RECT   tRect = new RECT(x, y, x + tSize.cx, y + tSize.cy);
                 paint.DrawText(name, m_backColor, iFont, tRect);
             }
         }
     }
 }
Exemple #55
0
 public static partial COLORREF GetSysColor(COLOR nIndex);
Exemple #56
0
    public void ChangeShapeAndColor()
    {
        shape = (SHAPE)Random.Range((int)SHAPE.START, (int)SHAPE.END);
        color = (COLOR)Random.Range((int)COLOR.START, (int)COLOR.END);

        Renderer renderer = gameObject.GetComponent<Renderer>();

        if (shape == SHAPE.CIRCLE)
        {
            switch (color)
            {
                case COLOR.RED:
                    renderer.material.mainTexture = Resources.Load("RedCircle") as Texture;
                    break;

                case COLOR.BLUE:
                    renderer.material.mainTexture = Resources.Load("BlueCircle") as Texture;
                    break;
                case COLOR.YELLOW:
                    renderer.material.mainTexture = Resources.Load("YellowCircle") as Texture;
                    break;
                default:
                    break;
            }
        }
        else if (shape == SHAPE.TRIANGLE)
        {
            switch (color)
            {
                case COLOR.RED:
                    renderer.material.mainTexture = Resources.Load("RedTri") as Texture;
                    break;

                case COLOR.BLUE:
                    renderer.material.mainTexture = Resources.Load("BlueTri") as Texture;
                    break;
                case COLOR.YELLOW:
                    renderer.material.mainTexture = Resources.Load("YellowTri") as Texture;
                    break;
                default:
                    break;
            }
        }
        else if (shape == SHAPE.RECT)
        {
            switch (color)
            {
                case COLOR.RED:
                    renderer.material.mainTexture = Resources.Load("RedRect") as Texture;
                    break;

                case COLOR.BLUE:
                    renderer.material.mainTexture = Resources.Load("BlueRect") as Texture;
                    break;
                case COLOR.YELLOW:
                    renderer.material.mainTexture = Resources.Load("YellowRect") as Texture;
                    break;
                default:
                    break;
            }
        }
        else
        {

        }
    }
	void Start(){
	ColorsArray[0]=new COLOR(GameObject.Find("greenc"),true,Color.green,0);
	ColorsArray[1]=new COLOR(GameObject.Find("redc"),true,Color.red,0);
	ColorsArray[2]=new COLOR(GameObject.Find("bluec"),true,Color.blue,0);
	ColorsArray[3]=new COLOR(GameObject.Find("orangec"),true,Globals.Orange,0);
	ColorsArray[4]=new COLOR(GameObject.Find("yellowc"),true,Color.yellow,0);
	ColorsArray[5]=new COLOR(GameObject.Find("whitec"),true,Color.white,0);
		ColorNumber=0;
		PrevGameObj=null;
		PrevColorNumber=0;
		Corners = new Combination[8];
		Edges = new Combination[12];
		Corners [0].name = "gow";
		Corners[0].flag=true;
		Corners [1].name = "owy";
		Corners[1].flag=true;
		Corners [2].name = "bgw";
		Corners[2].flag=true;
		Corners [3].name = "gor";
		Corners[3].flag=true;
		Corners [4].name = "bwy";
		Corners[4].flag=true;
		Corners [5].name = "ory";
		Corners[5].flag=true;
		Corners [6].name = "bry";
		Corners[6].flag=true;
		Corners [7].name = "bgr";
		Corners[7].flag=true;
		Edges[0].name="gw";
		Edges[0].flag=true;
		Edges[1].name="bw";
		Edges[1].flag=true;
		Edges[2].name="ow";
		Edges[2].flag=true;
		Edges[3].name="wy";
		Edges[3].flag=true;
		Edges[4].name="bg";
		Edges[4].flag=true;
		Edges[5].name="by";
		Edges[5].flag=true;
		Edges[6].name="or";
		Edges[6].flag=true;
		Edges[7].name="ry";
		Edges[7].flag=true;
		Edges[8].name="go";
		Edges[8].flag=true;
		Edges[9].name="oy";
		Edges[9].flag=true;
		Edges[10].name="br";
		Edges[10].flag=true;
		Edges[11].name="gr";
		Edges[11].flag=true;
		
		Globals.ThePanel=GameObject.Find("PopUp");
		Globals.ThePanel.SetActive(false);
		
		Globals.ColoredWronglyPanel=GameObject.Find("WrongColoring");
		Globals.ColoredWronglyPanel.SetActive(false);
		
		Globals.VerifyPanel=GameObject.Find("VerifyPanel");
		Globals.VerifyPanel.SetActive(false);
		
		Globals.dontShowAgain=false;
	}
Exemple #58
0
 /// <summary>
 /// Function: OrderClose
 /// Description: Closes opened order.
 /// URL: http://mm.l/mql4/docs.mql4.com/trading/orderclose.html
 /// </summary>
 /// <param name="ticket">[in] Unique number of the order ticket.</param>
 /// <param name="lots">[in] Number of lots.</param>
 /// <param name="price">[in] Closing price.</param>
 /// <param name="slippage">[in] Value of the maximum price slippage in points.</param>
 /// <param name="arrow_color">[in] Color of the closing arrow on the chart. If the parameter is missing or has CLR_NONE value closing arrow will not be drawn on the chart.</param>
 public bool OrderClose(int ticket, double lots, double price, int slippage, COLOR arrow_color)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(ticket);
     parameters.Add(lots);
     parameters.Add(price);
     parameters.Add(slippage);
     parameters.Add(arrow_color);
     MQLCommandManager.getInstance().ExecCommand(MQLCommand.OrderClose_1, parameters); // MQLCommand ENUM = 107
     while (MQLCommandManager.getInstance().IsCommandRunning()) Thread.Sleep(1);
     return (bool) MQLCommandManager.getInstance().GetCommandResult();
 }