/// <summary>
 /// Evolved constructor
 /// </summary>
 /// <param name="p_Id">Id code</param>
 /// <param name="p_bMasterLedOn">Led On definition</param>
 /// <param name="p_pInitalLocation">Initial location</param>
 /// <param name="p_dDirection">Direction</param>
 /// <param name="p_sSpeed">Speed</param>
 public LedMatrixItem(int p_Id,
                      bool[,]       p_bMasterLedOn,
                      Point p_pInitalLocation,
                      ItemDirection p_dDirection,
                      ItemSpeed p_sSpeed)
 {
     // Initialisations
     m_Id               = p_Id;
     m_bMasterLedOn     = p_bMasterLedOn;
     m_dDirection       = p_dDirection;
     m_sSpeed           = p_sSpeed;
     m_pCurrentLocation = p_pInitalLocation;
 }
        /// <summary>
        /// Set the speed of an item
        /// </summary>
        /// <param name="p_iItemId">Id of the item</param>
        /// <param name="p_sSpeed">New speed</param>
        public void SetItemSpeed(int p_iItemId,
                                 ItemSpeed p_sSpeed)
        {
            int iItemIdx = -1;

            // Get the item index
            iItemIdx = GetItemIdxFromId(p_iItemId);
            if (iItemIdx == -1)
            {
                return;
            }

            // Set new speed
            m_lItemList[iItemIdx].SetSpeed(p_sSpeed);
            return;
        }
        /// <summary>
        /// Add an item built from text to the item list
        /// </summary>
        /// <param name="p_sText">New item text</param>
        /// <param name="p_pLocation">Initial position of the new item</param>
        /// <param name="p_dDirection">Direction of the new item</param>
        /// <param name="p_sSpeed">Speed of the new item</param>
        /// <returns>Item Id</returns>
        public int AddTextItem(string p_sText,
                               Point p_pLocation,
                               ItemDirection p_dDirection,
                               ItemSpeed p_sSpeed)
        {
            // Updates Id counting
            m_iItemIdCount++;

            // New item
            LedMatrixItem lmiMyNewItem = new LedMatrixItem(m_iItemIdCount,
                                                           GetLedOnFromString(p_sText),
                                                           p_pLocation,
                                                           p_dDirection,
                                                           p_sSpeed);

            // Add the item to the list
            m_lItemList.Add(lmiMyNewItem);

            // Return item Id
            return(m_iItemIdCount);
        }
        /// <summary>
        /// Add an item to the item list
        /// </summary>
        /// <param name="p_bMasterLedOn">Led On definition of the new item</param>
        /// <param name="p_pLocation">Initial position of the new item</param>
        /// <param name="p_dDirection">Direction of the new item</param>
        /// <param name="p_sSpeed">Speed of the new item</param>
        /// <returns>Item Id</returns>
        public int AddItem(bool[,]       p_bMasterLedOn,
                           Point p_pLocation,
                           ItemDirection p_dDirection,
                           ItemSpeed p_sSpeed)
        {
            // Updates Id counting
            m_iItemIdCount++;

            // New item
            LedMatrixItem lmiMyNewItem = new LedMatrixItem(m_iItemIdCount,
                                                           p_bMasterLedOn,
                                                           p_pLocation,
                                                           p_dDirection,
                                                           p_sSpeed);

            // Add the item to the list
            m_lItemList.Add(lmiMyNewItem);

            // Return item Id
            return(m_iItemIdCount);
        }
Example #5
0
    // 读取规则XML
    private void ReadSpeed()
    {
        XMLParser xmlparse = new XMLParser();
        XMLNode   node     = xmlparse.Parse(_xmldata.text);

        XMLNodeList list = node.GetNodeList("ROOT>0>table");

        for (int i = 0; i < list.Count; i++)
        {
            string id     = node.GetValue("ROOT>0>table>" + i + ">@id");
            string speedv = node.GetValue("ROOT>0>table>" + i + ">@speedv");
            string speedh = node.GetValue("ROOT>0>table>" + i + ">@speedh");

            ItemSpeed itemSpeed = new ItemSpeed();
            itemSpeed.id      = int.Parse(id);
            itemSpeed.speed_V = (double)(double.Parse(speedv) / 10);
            itemSpeed.speed_H = (double)(double.Parse(speedh) / 10);

            _speedListR.Add(itemSpeed);
        }
    }
 /// <summary>
 /// Define the speed of the item
 /// </summary>
 /// <param name="p_sSpeed">Speed of the item</param>
 public void SetSpeed(ItemSpeed p_sSpeed)
 {
     m_sSpeed = p_sSpeed;
 }
Example #7
0
    public void SetGameItemSpeed()
    {
        ArrayList speedList = XMLManager.Instance._speedList;

        ItemSpeed itemSpeed_1001 = (ItemSpeed)speedList[0];

        GameSystem.Instance.Item_1001_V_Speed = itemSpeed_1001.speed_V;
        GameSystem.Instance.Item_1001_H_Speed = itemSpeed_1001.speed_H;

        ItemSpeed itemSpeed_1002 = (ItemSpeed)speedList[1];

        GameSystem.Instance.Item_1002_V_Speed = itemSpeed_1002.speed_V;
        GameSystem.Instance.Item_1002_H_Speed = itemSpeed_1002.speed_H;

        ItemSpeed itemSpeed_1003 = (ItemSpeed)speedList[2];

        GameSystem.Instance.Item_1003_V_Speed = itemSpeed_1003.speed_V;
        GameSystem.Instance.Item_1003_H_Speed = itemSpeed_1003.speed_H;

        ItemSpeed itemSpeed_1004 = (ItemSpeed)speedList[3];

        GameSystem.Instance.Item_1004_V_Speed = itemSpeed_1004.speed_V;
        GameSystem.Instance.Item_1004_H_Speed = itemSpeed_1004.speed_H;

        ItemSpeed itemSpeed_1005 = (ItemSpeed)speedList[4];

        GameSystem.Instance.Item_1005_V_Speed = itemSpeed_1005.speed_V;
        GameSystem.Instance.Item_1005_H_Speed = itemSpeed_1005.speed_H;

        ItemSpeed itemSpeed_1006 = (ItemSpeed)speedList[5];

        GameSystem.Instance.Item_1006_V_Speed = itemSpeed_1006.speed_V;
        GameSystem.Instance.Item_1006_H_Speed = itemSpeed_1006.speed_H;

        ItemSpeed itemSpeed_1007 = (ItemSpeed)speedList[6];

        GameSystem.Instance.Item_1007_V_Speed = itemSpeed_1007.speed_V;
        GameSystem.Instance.Item_1007_H_Speed = itemSpeed_1007.speed_H;

        ItemSpeed itemSpeed_1008 = (ItemSpeed)speedList[7];

        GameSystem.Instance.Item_1008_V_Speed = itemSpeed_1008.speed_V;
        GameSystem.Instance.Item_1008_H_Speed = itemSpeed_1008.speed_H;

        ItemSpeed itemSpeed_1009 = (ItemSpeed)speedList[8];

        GameSystem.Instance.Item_1009_V_Speed = itemSpeed_1009.speed_V;
        GameSystem.Instance.Item_1009_H_Speed = itemSpeed_1009.speed_H;

        ItemSpeed itemSpeed_1010 = (ItemSpeed)speedList[9];

        GameSystem.Instance.Item_1010_V_Speed = itemSpeed_1010.speed_V;
        GameSystem.Instance.Item_1010_H_Speed = itemSpeed_1010.speed_H;

        ItemSpeed itemSpeed_1011 = (ItemSpeed)speedList[10];

        GameSystem.Instance.Item_1011_V_Speed = itemSpeed_1011.speed_V;
        GameSystem.Instance.Item_1011_H_Speed = itemSpeed_1011.speed_H;

        ItemSpeed itemSpeed_1012 = (ItemSpeed)speedList[11];

        GameSystem.Instance.Item_1012_V_Speed = itemSpeed_1012.speed_V;
        GameSystem.Instance.Item_1012_H_Speed = itemSpeed_1012.speed_H;

        ItemSpeed itemSpeed_1013 = (ItemSpeed)speedList[12];

        GameSystem.Instance.Item_1013_V_Speed = itemSpeed_1013.speed_V;
        GameSystem.Instance.Item_1013_H_Speed = itemSpeed_1013.speed_H;

        ItemSpeed itemSpeed_1014 = (ItemSpeed)speedList[13];

        GameSystem.Instance.Item_1014_V_Speed = itemSpeed_1014.speed_V;
        GameSystem.Instance.Item_1014_H_Speed = itemSpeed_1014.speed_H;

        ItemSpeed itemSpeed_1015 = (ItemSpeed)speedList[14];

        GameSystem.Instance.Item_1015_V_Speed = itemSpeed_1015.speed_V;
        GameSystem.Instance.Item_1015_H_Speed = itemSpeed_1015.speed_H;
    }