示例#1
0
        public void HandleInput(string json)
        {
            try
            {
                JObject data = JObject.Parse(json);

                switch ((string)data.GetValue("message_type"))
                {
                case "start_app":
                    TableApp app = TableAppManager.GetAppById((string)data.GetValue("app"));
                    Program.tableAppManager.LaunchApp(app);

                    CustomInterface customInterface = app.GetCustomInterface();
                    Send("{\"message_type\": \"show_interface\", \"app\": {\"name\": \"" + app.GetName().Replace("TableApp", "") + "\", \"id\": \"" + app.GetName() + "\"}, \"interface\": {\"items\": " + customInterface.toJson() + "}}");
                    break;

                case "input":
                    JObject input = JObject.Parse(data["input"].ToString());

                    Program.tableAppManager.GetCurrentApp()
                    .OnCustomInterfaceInput((string)input.GetValue("id"), (string)input.GetValue("value"));
                    break;
                }
            }
            catch (Exception e)
            {
                Program.LogFullLength(TAG, "Parsing received message failed! " + e.ToString());
            }
        }
示例#2
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            CustomInterface custom = new CustomInterface();

            FocusManager.Instance.SetCustomAlgorithm(custom);

            var absLayout = new View
            {
                Layout             = new AbsoluteLayout(),
                WidthResizePolicy  = ResizePolicyType.FillToParent,
                HeightResizePolicy = ResizePolicyType.FillToParent,
                Focusable          = true,
                FocusableInTouch   = true,
            };

            window.Add(absLayout);

            for (int row = 0; row < 5; row++)
            {
                for (int cols = 0; cols < 5; cols++)
                {
                    var btn = MakeFocusableButton($"{row * 5 + cols}");
                    btn.Position = new Position(ItemWidth + cols * (ItemWidth + ItemSpacing), ItemHeight + 300 + row * (ItemHeight + ItemSpacing));
                    absLayout.Add(btn);
                }
            }
        }
        public void SetUp()
        {
            this.schema = new GraphQLSchema();

            var rootType   = new RootQueryType();
            var nestedType = new NestedQueryType();

            nestedType.Field("howdy", () => "xzyt");

            var anotherSestedType = new AnotherNestedQueryType();

            anotherSestedType.Field("stuff", () => "a");

            nestedType.Field("anotherNested", () => anotherSestedType);
            rootType.Field("nested", () => nestedType);

            var typeWithAccessor = new CustomObject();

            typeWithAccessor.Field("Hello", e => e.Hello);
            typeWithAccessor.Field("Test", e => e.Test);

            var anotherTypeWithAccessor = new AnotherCustomObject();

            anotherTypeWithAccessor.Field("Hello", e => e.Hello);
            anotherTypeWithAccessor.Field("World", e => e.World);

            var customInterface = new CustomInterface();

            customInterface.Field("hello", e => e.Hello);

            rootType.Field("acessorBasedProp", () => new TestType()
            {
                Hello = "world", Test = "stuff"
            });
            rootType.Field("testTypes", () => new ITestInterface[] {
                new TestType {
                    Hello = "world", Test = "stuff"
                },
                new AnotherTestType {
                    Hello = "world", World = "hello"
                }
            });

            this.schema.AddKnownType(new TestEnumType());
            this.schema.AddKnownType(rootType);
            this.schema.AddKnownType(anotherSestedType);
            this.schema.AddKnownType(nestedType);
            this.schema.AddKnownType(typeWithAccessor);
            this.schema.AddKnownType(anotherTypeWithAccessor);
            this.schema.AddKnownType(customInterface);
            this.schema.Query(rootType);
        }
        public int RegisterCustomer(CustomInterface.Customer customer)
        {
            using (DataClassesCustomerDataContext ctx = new DataClassesCustomerDataContext())
            {
                Customer customerToInsert;
                customerToInsert = new Customer();
                customerToInsert.CustomerName = customer.CustomerName;
                customerToInsert.CustomerFirstName = customer.CustomerFirstName;
                ctx.Customer.InsertOnSubmit(customerToInsert);
                ctx.SubmitChanges();
                return customerToInsert.CustomerID;

            }
        }
        public void LaunchApp(TableApp app)
        {
            if (app != null)
            {
                Program.Log(TAG, "Starting app: " + app.GetName());
            }

            currentApp = app;

            appThread = new Thread(delegate()
            {
                TableApp a = app;
                a.Init();

                if (a.userInterface == TableApp.ClientUserInterface.Custom)
                {
                    CustomInterface customInterface = a.GetCustomInterface();
                    string itemString = string.Empty;
                    for (int i = 0; i < customInterface.items.Count; i++)
                    {
                        itemString += customInterface.items[i];
                        if (i != customInterface.items.Count - 1)
                        {
                            itemString += ",";
                        }
                    }

                    ///Program.communicationServer.Send("create_custom_interface " + itemString);
                }

                int customSpeed = Program.GetParameterInt("appspeed", -1);
                while (a == currentApp)
                {
                    a.Draw();
                    a.RenderToTable();

                    Thread.Sleep(customSpeed >= 0 ? customSpeed : a.updateSpeed);
                }
            });
            if (currentApp != null)
            {
                appThread.Start();
            }
        }
示例#6
0
        public override void Start()
        {
            base.Start();

            captain          = Character.Controlled;
            radioSpeakerName = TextManager.Get("Tutorial.Radio.Watchman");
            GameMain.GameSession.CrewManager.AllowCharacterSwitch = false;

            var revolver = FindOrGiveItem(captain, "revolver");

            revolver.Unequip(captain);
            captain.Inventory.RemoveItem(revolver);

            var captainscap =
                captain.Inventory.FindItemByIdentifier("captainscap1") ??
                captain.Inventory.FindItemByIdentifier("captainscap2") ??
                captain.Inventory.FindItemByIdentifier("captainscap3");

            if (captainscap != null)
            {
                captainscap.Unequip(captain);
                captain.Inventory.RemoveItem(captainscap);
            }

            var captainsuniform =
                captain.Inventory.FindItemByIdentifier("captainsuniform1") ??
                captain.Inventory.FindItemByIdentifier("captainsuniform2") ??
                captain.Inventory.FindItemByIdentifier("captainsuniform3");

            if (captainsuniform != null)
            {
                captainsuniform.Unequip(captain);
                captain.Inventory.RemoveItem(captainsuniform);
            }

            var steerOrder = Order.GetPrefab("steer");

            captain_steerIcon      = steerOrder.SymbolSprite;
            captain_steerIconColor = steerOrder.Color;

            // Room 2
            captain_equipmentObjectiveSensor = Item.ItemList.Find(i => i.HasTag("captain_equipmentobjectivesensor")).GetComponent <MotionSensor>();
            captain_equipmentCabinet         = Item.ItemList.Find(i => i.HasTag("captain_equipmentcabinet")).GetComponent <ItemContainer>();
            captain_firstDoor      = Item.ItemList.Find(i => i.HasTag("captain_firstdoor")).GetComponent <Door>();
            captain_firstDoorLight = Item.ItemList.Find(i => i.HasTag("captain_firstdoorlight")).GetComponent <LightComponent>();

            SetDoorAccess(captain_firstDoor, captain_firstDoorLight, true);

            // Room 3
            captain_medicObjectiveSensor = Item.ItemList.Find(i => i.HasTag("captain_medicobjectivesensor")).GetComponent <MotionSensor>();
            captain_medicSpawnPos        = Item.ItemList.Find(i => i.HasTag("captain_medicspawnpos")).WorldPosition;
            tutorial_submarineDoor       = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoor")).GetComponent <Door>();
            tutorial_submarineDoorLight  = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoorlight")).GetComponent <LightComponent>();
            var medicInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("medicaldoctor"));

            captain_medic        = Character.Create(medicInfo, captain_medicSpawnPos, "medicaldoctor");
            captain_medic.TeamID = Character.TeamType.Team1;
            captain_medic.GiveJobItems(null);
            captain_medic.CanSpeak = captain_medic.AIController.Enabled = false;
            SetDoorAccess(tutorial_submarineDoor, tutorial_submarineDoorLight, false);

            // Submarine
            captain_enteredSubmarineSensor    = Item.ItemList.Find(i => i.HasTag("captain_enteredsubmarinesensor")).GetComponent <MotionSensor>();
            tutorial_submarineReactor         = Item.ItemList.Find(i => i.HasTag("engineer_submarinereactor")).GetComponent <Reactor>();
            captain_navConsole                = Item.ItemList.Find(i => i.HasTag("command")).GetComponent <Steering>();
            captain_navConsoleCustomInterface = Item.ItemList.Find(i => i.HasTag("command")).GetComponent <CustomInterface>();
            captain_sonar         = captain_navConsole.Item.GetComponent <Sonar>();
            captain_statusMonitor = Item.ItemList.Find(i => i.HasTag("captain_statusmonitor"));

            tutorial_submarineReactor.CanBeSelected = false;
            tutorial_submarineReactor.IsActive      = tutorial_submarineReactor.AutoTemp = false;

            tutorial_lockedDoor_1 = Item.ItemList.Find(i => i.HasTag("tutorial_lockeddoor_1")).GetComponent <Door>();
            tutorial_lockedDoor_2 = Item.ItemList.Find(i => i.HasTag("tutorial_lockeddoor_2")).GetComponent <Door>();
            SetDoorAccess(tutorial_lockedDoor_1, null, false);
            SetDoorAccess(tutorial_lockedDoor_2, null, false);

            var mechanicInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("mechanic"));

            captain_mechanic        = Character.Create(mechanicInfo, WayPoint.GetRandom(SpawnType.Human, mechanicInfo.Job, Submarine.MainSub).WorldPosition, "mechanic");
            captain_mechanic.TeamID = Character.TeamType.Team1;
            captain_mechanic.GiveJobItems();

            var securityInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("securityofficer"));

            captain_security        = Character.Create(securityInfo, WayPoint.GetRandom(SpawnType.Human, securityInfo.Job, Submarine.MainSub).WorldPosition, "securityofficer");
            captain_security.TeamID = Character.TeamType.Team1;
            captain_security.GiveJobItems();

            var engineerInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("engineer"));

            captain_engineer        = Character.Create(engineerInfo, WayPoint.GetRandom(SpawnType.Human, engineerInfo.Job, Submarine.MainSub).WorldPosition, "engineer");
            captain_engineer.TeamID = Character.TeamType.Team1;
            captain_engineer.GiveJobItems();

            captain_mechanic.CanSpeak             = captain_security.CanSpeak = captain_engineer.CanSpeak = false;
            captain_mechanic.AIController.Enabled = captain_security.AIController.Enabled = captain_engineer.AIController.Enabled = false;
        }
示例#7
0
 public override void Initialize()
 {
     Images.Cache();
     _target   = metadata.value as CustomInterface;
     generator = CustomInterfaceGenerator.GetDecorator(_target);
 }