コード例 #1
0
ファイル: MetaGen.cs プロジェクト: MetaGenAI/MetaGenNeos
        private void SetUpConfigSlot()
        {
            config_slot = World.RootSlot.FindChild((Slot s) => s.Name == "metagen config");
            if (config_slot == null)
            {
                config_slot = World.RootSlot.AddSlot("metagen config");
            }
            config_space = config_slot.GetComponent <DynamicVariableSpace>();
            if (config_space == null)
            {
                config_space = config_slot.AttachComponent <DynamicVariableSpace>();
            }
            config_space.SpaceName.Value = "metagen config space";
            interaction_slot             = config_slot.FindChild((Slot s) => s.Name == "metagen interaction");
            if (interaction_slot == null)
            {
                interaction_slot = config_slot.AddSlot("metagen interaction");
            }
            interaction_space = interaction_slot.GetComponent <DynamicVariableSpace>();
            if (interaction_space == null)
            {
                interaction_space = interaction_slot.AttachComponent <DynamicVariableSpace>();
            }
            interaction_space.SpaceName.Value = "metagen interaction space";

            text_interaction_slot = interaction_slot.FindChild((Slot s) => s.Name == "metagen text interaction");
            if (text_interaction_slot == null)
            {
                text_interaction_slot = interaction_slot.AddSlot("metagen text interaction");
                text_interaction_slot.CreateVariable <Sync <string> >("output field", null);
                text_interaction_slot.CreateVariable <Sync <string> >("input field", null);
            }

            field_interaction_slot = interaction_slot.FindChild((Slot s) => s.Name == "metagen field interaction");
            if (field_interaction_slot == null)
            {
                field_interaction_slot = interaction_slot.AddSlot("metagen field interaction");
            }
            input_interaction_fields_slot = field_interaction_slot.FindChild((Slot s) => s.Name == "input fields");
            if (input_interaction_fields_slot == null)
            {
                input_interaction_fields_slot = field_interaction_slot.AddSlot("input fields");
            }
            input_interaction_fields_slot.ChildAdded -= Interaction_fields_slot_ChildAdded;
            input_interaction_fields_slot.ChildAdded += Interaction_fields_slot_ChildAdded;
            output_interaction_fields_slot            = field_interaction_slot.FindChild((Slot s) => s.Name == "output fields");
            if (output_interaction_fields_slot == null)
            {
                output_interaction_fields_slot = field_interaction_slot.AddSlot("output fields");
            }
            output_interaction_fields_slot.ChildAdded -= Interaction_fields_slot_ChildAdded;
            output_interaction_fields_slot.ChildAdded += Interaction_fields_slot_ChildAdded;

            extra_meshes_slot = config_slot.FindChild((Slot s) => s.Name == "metagen extra meshes");
            if (extra_meshes_slot == null)
            {
                extra_meshes_slot = config_slot.AddSlot("metagen extra meshes");
            }
            extra_meshes_slot.ChildAdded -= Extra_meshes_slot_ChildAdded;
            extra_meshes_slot.ChildAdded += Extra_meshes_slot_ChildAdded;
            extra_slots_slot              = config_slot.FindChild((Slot s) => s.Name == "metagen extra slots");
            if (extra_slots_slot == null)
            {
                extra_slots_slot = config_slot.AddSlot("metagen extra slots");
            }
            extra_slots_slot.ChildAdded -= Extra_slots_slot_ChildAdded;
            extra_slots_slot.ChildAdded += Extra_slots_slot_ChildAdded;
            extra_fields_slot            = config_slot.FindChild((Slot s) => s.Name == "metagen extra fields");
            if (extra_fields_slot == null)
            {
                extra_fields_slot = config_slot.AddSlot("metagen extra fields");
            }
            extra_fields_slot.ChildAdded -= Extra_fields_slot_ChildAdded;
            extra_fields_slot.ChildAdded += Extra_fields_slot_ChildAdded;
            users_config_slot             = config_slot.FindChild((Slot s) => s.Name == "metagen users config");
            if (users_config_slot == null)
            {
                users_config_slot  = config_slot.AddSlot("metagen users config");
                users_config_space = users_config_slot.AttachComponent <DynamicVariableSpace>();
            }
            users_config_space = users_config_slot.GetComponent <DynamicVariableSpace>();
            users_config_space.SpaceName.Value = "metagen users config space";
            if (users_config_space == null)
            {
                users_config_space = users_config_slot.AttachComponent <DynamicVariableSpace>();
                users_config_space.SpaceName.Value = "metagen users config space";
            }
        }
コード例 #2
0
        //private void OpenErrorPage(string error)
        //{
        //    UIBuilder uiBuilder = this.SwapPanel(NeosSwapCanvasPanel.Slide.Left, 0.5f);
        //    uiBuilder.VerticalLayout(4f, 0.0f, new Alignment?());
        //    uiBuilder.Style.PreferredHeight = 32f;
        //    uiBuilder.Style.MinHeight = 32f;
        //    uiBuilder.Style.FlexibleHeight = 100f;
        //    LocaleString text1 = (LocaleString)error;
        //    uiBuilder.Text(in text1, true, new Alignment?(), true, (string)null);
        //    uiBuilder.Style.FlexibleHeight = -1f;
        //    LocaleString text2 = "CameraControl.OBS.ReturnToConnect".AsLocaleKey((string)null, true, (Dictionary<string, IField>)null);
        //    uiBuilder.Button(in text2, new ButtonEventHandler(this.OnReturnToConnect));
        //}

        public void LinkUISlot()
        {
            UniLog.Log("Linking UI slot");
            //Slot slot = UISlot.Duplicate();
            Slot slot = UISlot ?? _uiTemplateRefField.Target.Reference.Target;

            UniLog.Log(slot);
            DynamicVariableSpace space = slot.FindSpace("UIVariables");

            if (space == null)
            {
                return;
            }
            UniLog.Log("Found dynamic variable space");

            ////Recording checkbox
            //Checkbox recording_checkbox;
            //space.TryReadValue<Checkbox>("recording_checkbox", out recording_checkbox);
            //this._recordUserCheckbox.Target = recording_checkbox;

            ////Data submission checkbox
            //Checkbox public_checkbox;
            //space.TryReadValue<Checkbox>("public_checkbox", out public_checkbox);
            //this._publicDomainCheckbox.Target = public_checkbox;

            //Recording time
            Text recording_time_text;

            space.TryReadValue <Text>("recording_time_text", out recording_time_text);
            this._recordingTime.Target = recording_time_text;

            //Animation checkbox
            Checkbox animation_checkbox;

            space.TryReadValue <Checkbox>("animation_checkbox", out animation_checkbox);
            this._animationsCheckbox.Target = animation_checkbox;

            //Generate Bvh checkbox
            Checkbox generate_bvh_checkbox;

            space.TryReadValue <Checkbox>("generate_bvh_checkbox", out generate_bvh_checkbox);
            this._generateBvhCheckbox.Target = generate_bvh_checkbox;

            //Record voices checkbox
            Checkbox record_voices_checkbox;

            space.TryReadValue <Checkbox>("record_voices_checkbox", out record_voices_checkbox);
            this._recordVoicesCheckbox.Target = record_voices_checkbox;

#if NOHL
            //Record voices checkbox
            Checkbox record_hearing_checkbox;
            space.TryReadValue <Checkbox>("record_hearing_checkbox", out record_hearing_checkbox);
            this._recordHearingCheckbox.Target = record_hearing_checkbox;
#endif

#if NOHL
            //Video checkbox
            Checkbox video_checkbox;
            space.TryReadValue <Checkbox>("video_checkbox", out video_checkbox);
            this._videoCheckbox.Target = video_checkbox;
#endif

            //Record button
            Button record_button;
            space.TryReadValue <Button>("record_button", out record_button);
            this._recordButton.Target = record_button;

            //Recording index
            TextField recording_index;
            space.TryReadValue <TextField>("recording_index", out recording_index);
            this._recordIndexField.Target = recording_index;

            //Voices checkbox
            Checkbox voices_checkbox;
            space.TryReadValue <Checkbox>("voices_checkbox", out voices_checkbox);
            this._voicesCheckbox.Target = voices_checkbox;

            //Hearing checkbox
            Checkbox hearing_checkbox;
            space.TryReadValue <Checkbox>("hearing_checkbox", out hearing_checkbox);
            this._hearingCheckbox.Target = hearing_checkbox;

            //External source checkbox
            Checkbox external_source_checkbox;
            space.TryReadValue <Checkbox>("external_source_checkbox", out external_source_checkbox);
            this._externalSourceCheckbox.Target = external_source_checkbox;

            //Animation checkbox2
            Checkbox animation_checkbox2;
            space.TryReadValue <Checkbox>("animation_checkbox2", out animation_checkbox2);
            this._animationsCheckbox2.Target = animation_checkbox2;

            //Generate Bvh checkbox
            Checkbox generate_bvh_checkbox2;
            space.TryReadValue <Checkbox>("generate_bvh_checkbox2", out generate_bvh_checkbox2);
            this._generateBvhCheckbox2.Target = generate_bvh_checkbox2;

            //Avatar ref
            ReferenceField <Slot> avatar_ref_field;
            space.TryReadValue <ReferenceField <Slot> >("avatar_ref_field", out avatar_ref_field);
            this._avatarRefField.Target = avatar_ref_field;

            //Play button
            Button play_button;
            space.TryReadValue <Button>("play_button", out play_button);
            this._playButton.Target = play_button;

            UniLog.Log("Finished linking UI slot");
        }