예제 #1
0
        public LuaTable GetBranchInput(string branchId, int frame)
        {
            var table = Lua.NewTable();

            if (Engaged())
            {
                var branch = Tastudio.CurrentTasMovie.Branches.FirstOrDefault(b => b.UniqueIdentifier.ToString() == branchId);
                if (branch != null && frame < branch.InputLog.Count)
                {
                    var adapter = new Bk2ControllerAdapter
                    {
                        Definition = Global.MovieSession.MovieControllerAdapter.Definition
                    };

                    adapter.SetControllersAsMnemonic(branch.InputLog[frame]);

                    foreach (var button in adapter.Definition.BoolButtons)
                    {
                        table[button] = adapter.IsPressed(button);
                    }

                    foreach (var button in adapter.Definition.FloatControls)
                    {
                        table[button] = adapter.GetFloat(button);
                    }
                }
            }

            return(table);
        }
예제 #2
0
        private void ReSetLog()
        {
            // Get a IController that only contains buttons in key.
            string[]             keys = _inputKey.Split('|');
            ControllerDefinition d    = new ControllerDefinition();

            for (int i = 0; i < keys.Length; i++)
            {
                if (Global.Emulator.ControllerDefinition.BoolButtons.Contains(keys[i]))
                {
                    d.BoolButtons.Add(keys[i]);
                }
                else
                {
                    d.FloatControls.Add(keys[i]);
                }
            }
            Bk2ControllerAdapter newController = new Bk2ControllerAdapter()
            {
                Type = d
            };

            Bk2LogEntryGenerator logGenerator = new Bk2LogEntryGenerator("");

            logGenerator.SetSource(newController);
            logGenerator.GenerateLogEntry();             // Reference and create all buttons.
            // Reset all buttons in targetController (it may still have buttons that aren't being set here set true)
            Bk2LogEntryGenerator tC = new Bk2LogEntryGenerator("");

            tC.SetSource(targetController);
            targetController.SetControllersAsMnemonic(tC.EmptyEntry);
            for (int i = 0; i < Length; i++)
            {
                controller.SetControllersAsMnemonic(_log[i]);
                LatchFromSourceButtons(targetController, controller);
                newController.LatchFromSource(targetController);
                _log[i] = logGenerator.GenerateLogEntry();
            }

            controller = newController;
        }