Beispiel #1
0
        private static async Task CheckAssignments(AK.Wwise.Waapi.JsonClient client, List <SwitchContainerChild> assigned, List <SwitchContainerChild> unassigned, SwitchGroup matchingGroup, SwitchContainer container)
        {
            List <SwitchAssignment> toRemove = new List <SwitchAssignment>();

            foreach (var child in assigned)
            {
                var matchingSwitch = matchingGroup.switches.Where(s => s.name == child.name).First();

                var assignment = container.assignments.Where(a => a.child == child.id).First();

                if (matchingSwitch.id != assignment.stateOrSwitch)
                {
                    toRemove.Add(assignment);

                    unassigned.Add(child);

                    await client.Call
                    (
                        ak.wwise.core.switchContainer.removeAssignment, new JObject
                        (
                            new JProperty("stateOrSwitch", assignment.stateOrSwitch),
                            new JProperty("child", assignment.child)
                        ),
                        null
                    );
                }
            }

            container.assignments = container.assignments.Except(toRemove).ToList();
        }
Beispiel #2
0
        private static async Task MatchAndAssignSwitches(AK.Wwise.Waapi.JsonClient client, List <SwitchContainerChild> children, SwitchGroup matchingGroup)
        {
            foreach (var item in children)
            {
                var matchingSwitch = matchingGroup.switches.Where(switchGroup => switchGroup.name == item.name).First();

                await client.Call(
                    ak.wwise.core.switchContainer.addAssignment,
                    new JObject
                    (
                        new JProperty("stateOrSwitch", matchingSwitch.id),
                        new JProperty("child", item.id)
                    )
                    );
            }
        }