Esempio n. 1
0
        public static void UpdateAliases()
        {
            //ClearAliases();

            // Copy commands to alias list.
            for (int i = 0; i < inputNodeList.Length; i++)
            {
                aliasNodeList[i].Clear();
                foreach (UniversalInputCombo ic in inputNodeList[i].InternalInputCombos)
                {
                    aliasNodeList[i].AddCombo(ic.ToString());
                }
            }

            // Create requested aliases as long as there are no conflicts.
            foreach (Tuple <GameCommand, GameCommand> cb in crossBindings)
            {
                //if ((int)cb.Item1 >= (int)GameCommand.MenuUp) continue;
                //if ((int)cb.Item2 < (int)GameCommand.MenuUp) continue;
                InputNode leftNode       = inputNodeList[(int)cb.Item1];
                InputNode rightAliasNode = aliasNodeList[(int)cb.Item2];
                //foreach (UniversalInputCombo ic in leftNode.InternalInputCombos)
                for (int i = 0; i < leftNode.InternalInputCombos.Count; i++)
                {
                    UniversalInputCombo ic = leftNode.InternalInputCombos[i];
                    bool used = false;
                    int  startJ, endJ;
                    if ((int)cb.Item1 < (int)GameCommand.MenuUp)
                    {
                        startJ = (int)GameCommand.MenuUp;
                        endJ   = (int)GameCommand.Save;
                    }
                    else
                    {
                        startJ = (int)GameCommand.Up;
                        endJ   = (int)GameCommand.MenuUp;
                    }
                    for (int j = startJ; j < endJ; j++)
                    {
                        InputNode otherNode = inputNodeList[j];
                        if (otherNode.Conflict(ic))
                        {
                            used = true;
                            break;
                        }
                    }
                    if (!used)
                    {
                        rightAliasNode.AddCombo(leftNode.InternalInputCombos[i].ToString());
                    }
                }
            }

            Reset();
        }
Esempio n. 2
0
 public bool Conflict(UniversalInputCombo combo)
 {
     return(inputList.Last().Conflict(combo.inputList.Last()));
 }