Esempio n. 1
0
        public void Tick()
        {
            if (m_IsRunning)
            {
                lock (m_mapSession)
                {
                    uint current = (uint)TimeUtils.GetTotalMillisecondsSince1970();

                    if (current - m_lastClearSessionTime > FSPSession.ActiveTimeout * 1000 / 2)
                    {
                        m_lastClearSessionTime = current;
                        ClearNoActiveSession();
                    }


                    var list = m_mapSession.ToList();
                    int cnt  = list.Count;
                    for (int i = 0; i < cnt; i++)
                    {
                        var session = list[i];
                        session.Tick(current);
                    }
                }
            }
        }
Esempio n. 2
0
 public void EnterFrame()
 {
     if (m_gateway.IsRunning)
     {
         var listGame = m_mapGame.ToList();
         for (int i = 0; i < listGame.Count; i++)
         {
             listGame[i].EnterFrame();
         }
     }
 }
        /// <summary>
        /// Method attempts to order the maplist against a rough outline
        /// </summary>
        public void PerformOrdering()
        {
            // Rough idea of ordering
            // non-matches should be placed at the end
            CustomOrdering = new List <string>
            {
                "UP ↑",
                "DOWN ↓",
                "LEFT ←",
                "RIGHT →",

                "Left Stick UP ↑",
                "Left Stick DOWN ↓",
                "Left Stick LEFT ←",
                "Left Stick RIGHT →",
                "Left Stick, Button(L3)",

                "Right Stick UP ↑",
                "Right Stick DOWN ↓",
                "Right Stick LEFT ←",
                "Right Stick RIGHT →",
                "Right Stick, Button(R3)",

                "D-Pad UP ↑",
                "D-Pad DOWN ↓",
                "D-Pad LEFT ←",
                "D-Pad RIGHT →",

                "Analog UP ↑",
                "Analog DOWN ↓",
                "Analog LEFT ←",
                "Analog RIGHT →",

                "Stick FORE",
                "Stick BACK",
                "Stick LEFT",
                "Stick RIGHT",

                "L Stick FORE",
                "L Stick BACK",
                "L Stick LEFT",
                "L Stick RIGHT",
                "L Throttle Up",
                "L Throttle Down",

                "R Stick FORE",
                "R Stick BACK",
                "R Stick LEFT",
                "R Stick RIGHT",
                "R Throttle Up",
                "R Throttle Down",

                "X1(X UP ↑)",
                "X3(X DOWN ↓)",
                "X4(X LEFT ←)",
                "X2(X RIGHT →)",
                "Y1(Y UP ↑)",
                "Y3(Y DOWN ↓)",
                "Y4(Y LEFT ←)",
                "Y2(Y RIGHT →)",

                "Throttle Up",
                "Throttle Down",

                "L Gear Shift",
                "R Gear Shift",

                "Motion Up",
                "Motion Down",
                "Motion Left",
                "Motion Right",

                "A",
                "B",
                "C",

                "X",
                "Y",
                "Z",

                "Button 1",
                "Button 2",
                "Button 3",
                "Button 4",
                "Button 5",
                "Button 6",

                "I",
                "II",
                "III",
                "IV",
                "V",
                "VI",

                "I (Analog)",
                "II (Analog)",

                "△ (upper)",
                "○ (right)",
                "x (lower)",
                "□ (left)",

                "Fire 1/Start",
                "Fire 2",

                "Offscreen Shot",
                "Cursor",
                "Trigger",
                "Turbo",

                "SHOULDER L",
                "SHOULDER R",

                "Left Shoulder",
                "Right Shoulder",

                "Left-Back",
                "Right-Back",

                "L",
                "R",

                "L1 (front left shoulder)",
                "R1 (front right shoulder)",
                "L2 (rear left shoulder)",
                "R2 (rear right shoulder)",

                "Twist ↑|↓ (Analog, Turn Left)",
                "Twist ↓|↑ (Analog, Turn Right)",

                "Left Button",
                "Middle Button",
                "Right Button",

                "Away Trigger",
                "Trigger",
                "X Axis",
                "Y Axis",

                "SELECT",
                "START",
                "PAUSE",
                "MODE",
                "RUN",
                "Analog(mode toggle)",

                "Autofire Speed",

                "A AF",
                "B AF",
                "C AF",
                "X AF",
                "Y AF",
                "Z AF",
                "L AF",
                "R AF",

                "Rapid A",
                "Rapid B",
                "Rapid C",

                "Rapid X",
                "Rapid Y",
                "Rapid Z",

                "Rapid Button 1",
                "Rapid Button 2",
                "Rapid Button 3",
                "Rapid Button 4",
                "Rapid Button 5",
                "Rapid Button 6",

                "Rapid △",
                "Rapid ○",
                "Rapid x",
                "Rapid □",

                "Rapid Fire 1/Start",
                "Rapid Fire 2",

                "Rapid I",
                "Rapid II",

                "Tilt: UP ↑",
                "Tilt: DOWN ↓",
                "Tilt: LEFT ←",
                "Tilt: RIGHT →",

                "1",
                "2,",
                "3,",
                "4,",
                "5,",
                "6,",
                "7,",
                "8,",
                "9,",
                "10,",
                "11,",
                "12,",
                "13,",
                "14,",
                "15,",
                "16,",
                "17,",
                "18,",
                "19,",
                "20,",
            };


            // get a copy of the map list
            List <Mapping> working = MapList.ToList();

            // destructive copy
            List <Mapping> leftover = new List <Mapping>();

            List <Mapping> final = new List <Mapping>();

            // iterate through the sorting list
            foreach (var s in CustomOrdering)
            {
                // attempt to find matches - exact first
                var map = working.Where(a => a.Description.ToLower() == s.ToLower()).ToList();

                if (map.Count == 1)
                {
                    // exact match found
                    final.Add(map.First());
                    working.Remove(map.First());
                    continue;
                }

                // now try partial match
                var mapP = working.Where(a => a.Description.ToLower().StartsWith(s.ToLower() + " ")).ToList();

                if (mapP.Count == 1)
                {
                    // 1 entry
                    final.Add(mapP.First());
                    working.Remove(mapP.First());
                    continue;
                }
                if (mapP.Count > 1)
                {
                    // multiples found - for now add them all
                    final.AddRange(mapP);
                    foreach (var m in mapP)
                    {
                        working.Remove(m);
                    }

                    continue;
                }
            }

            // at this point all that are remaining should be added
            final.AddRange(working);

            MapList.Clear();
            MapList = final;
        }