Example #1
0
        private async void BtnImport_Click(object _1, RoutedEventArgs _2)
        {
            var openPicker = new FileOpenPicker
            {
                SuggestedStartLocation = PickerLocationId.DocumentsLibrary,
                //CommitButtonText = "Importar"
            };

            openPicker.FileTypeFilter.Add(".vestis");

            var file = await openPicker.PickSingleFileAsync();

            if (file != null)
            {
                var path = Path.Combine(DressingRoom.AppDirectory, "Vestis");

                var folder = await StorageFolder.GetFolderFromPathAsync(path);

                var stream = await file.CopyAsync(folder);

                DressingRoom.ImportPackage(stream.Path);
            }

            await CoreApplication.RequestRestartAsync("");
        }
Example #2
0
 private Case(Case testCase)
 {
     this.sheet        = testCase.sheet;
     this.caseName     = testCase.caseName;
     this.dressingRoom = testCase.dressingRoom;
     this.sections     = testCase.sections;
 }
Example #3
0
 //--------------------------------------------------
 public void UpdateAttachMent()
 {
     if (mVisual != null && mVisual.Visual != null && InitModelID == mModelResID)
     {
         for (uint i = 0; i < (uint)AttachMountType.AttachCount; ++i)
         {
             AttachMent attach = mAttachMents[i];
             if (attach == null || attach.parent != null)
             {
                 continue;
             }
             //挂接
             if (mVisual != null && attach.visual != null && attach.visual.Visual != null)
             {
                 Transform t = mVisual.GetBoneByName(attach.socketname);
                 if (t == null)
                 {
                     t = mVisual.VisualTransform;
                 }
                 attach.parent = t.gameObject;
                 attach.visual.Visual.SetActive(true);
                 DressingRoom.AttachObjectTo(t, attach.visual.VisualTransform, attach.transform);
             }
         }
     }
 }
    public void UpdateAttachMent()
    {
        if (mVisual != null && mVisual.Visual != null)
        {
            for (uint i = 0; i < (uint)AttachMountType.AttachCount; ++i)
            {
                AttachMent attach = mAttachMents[i];
                if (attach == null || attach.parent != null)
                {
                    continue;
                }
                //挂接
                if (mVisual != null && attach.visual != null && attach.visual.Visual != null)
                {
                    Transform t = mVisual.GetBoneByName(attach.socketname);
                    if (t == null)
                    {
                        t = mVisual.VisualTransform;
                    }
                    attach.parent       = t.gameObject;
                    attach.visual.Layer = layermask;
                    DressingRoom.AttachObjectTo(t, attach.visual.VisualTransform, attach.transform);

                    if (i == (uint)AttachMountType.Weapon)
                    {
                        OnWeaponSuccess();
                    }
                    else if (i == (uint)AttachMountType.Wing)
                    {
                        OnWingSuccess();
                    }
                }
            }
        }
    }
Example #5
0
        public void Execute(object parameter)
        {
            var split = (parameter as string)?.Split(':');

            var(user, garment) = (split[0], split[1]);
            var wardrobe = DressingRoom.ForUser(user).AsT0;

            (Window.Current.Content as Frame).Navigate(typeof(EditClothesPage), (wardrobe, garment));
        }
Example #6
0
        private async void BtnRestore_Click(object _1, RoutedEventArgs _2)
        {
            var confirm = new ConfirmRestore();
            await confirm.ShowAsync();

            if (confirm.Result is true)
            {
                DressingRoom.RestoreSettings();
                await CoreApplication.RequestRestartAsync("");
            }
        }
Example #7
0
        public async void Execute(object parameter)
        {
            var confirm = new ConfirmDeleteUser();

            await confirm.ShowAsync();

            if (confirm.Result is true)
            {
                DressingRoom.DisposeOf(parameter as string);
                (Window.Current.Content as Frame).Navigate(typeof(MainPage));
            }
        }
Example #8
0
        /// <summary>
        /// 指定されたテストケースにふさわしいアクターをアサインする。
        /// </summary>
        /// <param name="testCase">テストケース</param>
        /// <returns>アクター</returns>
        public virtual DressingRoom AssignActors(Case testCase)
        {
            DressingRoom dressingRoom = new DressingRoom();

            dressingRoom.StorageUpdaters.Add(Initialize(new DatabaseUpdater(), testCase));
            dressingRoom.StorageValidators.Add(Initialize(new DatabaseValidator(), testCase));
            dressingRoom.ObjectFactories.Add(Initialize(new TempObjectFactory(), testCase));
            dressingRoom.ObjectValidators.Add(Initialize(new TempObjectValidator(), testCase));
            dressingRoom.Conductor = Initialize(new TempConductor(), testCase);

            return(dressingRoom);
        }
Example #9
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            // Username
            OldUsername          = e?.Parameter as string;
            UserNameTextBox.Text = OldUsername;

            // Profile colors
            var colors = new List <string> {
                "218:47:47", "233:127:13", "220:163:0",
                "101:163:3", "32:128:32", "13:152:186",
                "48:108:194", "145:86:178", "120:128:136"
            };
            var userColor = DressingRoom.ColorFor(OldUsername);

            if (!colors.Contains(userColor))
            {
                colors.Add(userColor);
            }
            UserColorGrid.ItemsSource = colors.Select(c => new ColorWrapper
            {
                Color = c
            });
            var color = (UserColorGrid.ItemsSource as IEnumerable <ColorWrapper>)
                        .First(c => c.Color.Equals(userColor, StringComparison.InvariantCulture));

            UserColorGrid.SelectedIndex = colors.IndexOf(color.Color);

            // Profile icons
            var icons = new List <string>
            {
                "Assets/Icons/man.png",
                "Assets/Icons/woman.png",
                "Assets/Icons/baby-girl.png"
            };
            var userIcon = DressingRoom.IconFor(OldUsername);

            if (!icons.Contains(userIcon))
            {
                icons.Add(userIcon);
            }
            UserIconGrid.ItemsSource = icons.Select(i => new IconWrapper
            {
                Icon = i
            });
            var icon = (UserIconGrid.ItemsSource as IEnumerable <IconWrapper>)
                       .First(i => i.Icon.Equals(userIcon, StringComparison.InvariantCulture));

            UserIconGrid.SelectedIndex = icons.IndexOf(icon.Icon);
        }
Example #10
0
        public MainPage()
        {
            InitializeComponent();

            // Bind users to list
            var users = DressingRoom.ListAvailable();

            UserPanel.ItemsSource = users.Select(u => new
            {
                Username         = u,
                ProfileColor     = DressingRoom.ColorFor(u),
                ProfileIcon      = DressingRoom.IconFor(u),
                UserClickCommand = UserClickCommand.Instance
            });
        }
Example #11
0
        /// <summary>
        /// Se invoca cuando la aplicación la inicia normalmente el usuario final. Se usarán otros puntos
        /// de entrada cuando la aplicación se inicie para abrir un archivo específico, por ejemplo.
        /// </summary>
        /// <param name="e">Información detallada acerca de la solicitud y el proceso de inicio.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            var directory = Windows.Storage.ApplicationData.Current.RoamingFolder.Path;

            DressingRoom.SetAppDirectory(directory);

            // No repetir la inicialización de la aplicación si la ventana tiene contenido todavía,
            // solo asegurarse de que la ventana está activa.
            if (!(Window.Current.Content is Frame rootFrame))
            {
                // Crear un marco para que actúe como contexto de navegación y navegar a la primera página.
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e?.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Cargar el estado de la aplicación suspendida previamente
                }

                // Poner el marco en la ventana actual.
                Window.Current.Content = rootFrame;
            }

            if (e?.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // TODO Comprobar si se debe mostrar la página de bienvenida
                    if (DressingRoom.WelcomePageSeen())
                    {
                        rootFrame.Navigate(typeof(MainPage), e.Arguments);
                    }
                    else
                    {
                        rootFrame.Navigate(typeof(WelcomePage), e.Arguments);
                    }
                }
                // Asegurarse de que la ventana actual está activa.
                Window.Current.Activate();

                CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
                var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                titleBar.ButtonBackgroundColor         = Colors.Transparent;
                titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
            }
        }
Example #12
0
 public void DetachVisual(AttachMent attach)
 {
     if (attach == null)
     {
         return;
     }
     if (attach.visual != null)
     {
         Transform trans = null;
         if (attach.parent != null)
         {
             trans = attach.parent.transform;
         }
         DressingRoom.DetachObjectFrom(trans, attach.visual.Visual);
     }
     attachments.Remove(attach);
 }
Example #13
0
        public void TestUserWardrobe()
        {
            OneOf <Wardrobe, IFailure> result = new UninitializedVariable();
            Action act = () => result = DressingRoom.ForUser("TestUserOne");

            act.Should().NotThrow();
            var wardrobe = result.AsT0;

            wardrobe.Should().NotBeNull();

            act = () => result = DressingRoom.ForUser("TestUserTwo");

            act.Should().NotThrow();
            var failure = result.AsT1;

            failure.Should().NotBeNull();
        }
Example #14
0
        private async void BtnSaveUser_Click(object _1, RoutedEventArgs _2)
        {
            var username = UserNameTextBox.Text;

            // Validation: User name must have between 1 and 24 characters
            if (username.Length < 1 || username.Length > 24)
            {
                await new UserNameFormatError().ShowAsync();
                return;
            }
            // Validation: User name can only contain letters and dashes
            var regex = new Regex("^[A-Z\\-]+$");

            if (!regex.IsMatch(username.ToUpperInvariant()))
            {
                await new UserNameFormatError().ShowAsync();
                return;
            }
            // Validation: User name must not exist already
            if (DressingRoom.ListAvailable().Contains(username))
            {
                await new UserNameExistingError().ShowAsync();
                return;
            }
            // Validation: A profile color must be selected
            if (UserColorGrid.SelectedItem is null)
            {
                await new MissingProfileDataError().ShowAsync();
                return;
            }
            // Validation: A profile icon must be selected
            if (UserIconGrid.SelectedItem is null)
            {
                await new MissingProfileDataError().ShowAsync();
                return;
            }

            // Register new user
            var color = (UserColorGrid.SelectedItem as ColorWrapper).Color;
            var icon  = (UserIconGrid.SelectedItem as IconWrapper).Icon;

            DressingRoom.CreateNew(username, color, icon);

            Frame.Navigate(typeof(MainPage));
        }
Example #15
0
    /// <summary>
    /// 挂接一个显示对象
    /// </summary>
    protected AttachMent AttachVisual(PrimitiveVisual visual, string socketname, TransformData trans)
    {
        AttachMent attach = new AttachMent();

        attach.socketname = socketname;
        attach.transform  = trans;
        attach.visual     = visual;

        Transform bone = mVisual.GetBoneByName(attach.socketname);

        if (bone == null)
        {
            bone = mVisual.VisualTransform;
        }
        DressingRoom.AttachObjectTo(bone, attach.visual.VisualTransform, attach.transform);
        // BehaviourUtil.StartCoroutine(WaitForAttachComplete(attach));

        return(attach);
    }
Example #16
0
        private async void BtnExport_Click(object _1, RoutedEventArgs _2)
        {
            var savePicker = new FileSavePicker
            {
                SuggestedStartLocation = PickerLocationId.DocumentsLibrary,
                SuggestedFileName      = DateTime.Now.ToString("yyyy-MM-dd-HH-mm", CultureInfo.InvariantCulture),
                //CommitButtonText = "Exportar"
            };

            savePicker.FileTypeChoices.Add(".VESTIS", new List <string>()
            {
                ".vestis"
            });

            var file = await savePicker.PickSaveFileAsync();

            var export = DressingRoom.MakeExportPackage();

            await FileIO.WriteBufferAsync(file, await FileIO.ReadBufferAsync(await StorageFile.GetFileFromPathAsync(export)));

            File.Delete(export);
        }
Example #17
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var target = e?.Parameter;
            var result = DressingRoom.ForUser(target as string);

            user = result.AsT0;

            // Paint elements with user profile color
            DataContext = user;

            if (user.Garments.Any())
            {
                FillStatistics();
                FillNotifications();
            }

            // Preload weather information to avoid lag spike
            // when accessing combination page. Weather information
            // is cached for the next 30 minutes.
            new Thread(() =>
            {
                Console.WriteLine(DressingRoom.WeatherData);
            }).Start();
        }
Example #18
0
        public async void Execute(object parameter)
        {
            var split = (parameter as string)?.Split(':');

            var(user, garment) = (split[0], split[1]);
            var confirm = new ConfirmDeleteGarment();

            await confirm.ShowAsync();

            if (confirm.Result is true)
            {
                DressingRoom.ForUser(user).Match(wardrobe =>
                {
                    wardrobe.RemoveGarment(garment);
                    return(0);
                },
                                                 error =>
                {
                    return(-1);
                }
                                                 );
                (Window.Current.Content as Frame).Navigate(typeof(WardrobePage), DressingRoom.ForUser(user).AsT0);
            }
        }
Example #19
0
 /// <summary>
 /// テストケース定義を作成する。
 /// </summary>
 /// <param name="sheet">このテストケースが属すシート</param>
 /// <param name="caseName">テストケース名</param>
 /// <param name="director">ディレクタ</param>
 internal Case(Sheet sheet, string caseName, Director director)
 {
     this.sheet        = sheet;
     this.caseName     = caseName;
     this.dressingRoom = director.AssignActors(this);
 }
Example #20
0
 private void BtnNewUser_Click(object _1, RoutedEventArgs _2)
 {
     DressingRoom.SeeWelcomePage();
     Frame.Navigate(typeof(AddUserPage));
 }
Example #21
0
    /// <summary>
    /// 更新挂接特效
    /// </summary>
    public void UpdateAttachParticle()
    {
        SceneParticleManager particlemng = SceneManager.Instance.GetCurScene().GetParticleManager();
        int nCount = mAttachParticles.Count;
        List <ParticleAttachMent> toDel = null;

        for (int i = 0; i < nCount; ++i)
        {
            ParticleAttachMent attach = mAttachParticles[i];
            ParticleItem       item   = particlemng.GetParticle(attach.particleid);

            if (attach == null || item == null || item.IsDead())
            {
                if (toDel == null)
                {
                    toDel = new List <ParticleAttachMent>();
                }
                toDel.Add(attach);
                continue;
            }
            //将特效更新到对应位置上
            if (attach.parent == null || item.parent == null)
            {
                PrimitiveVisual aVisual = null;
                if (attach.atype != AttachMountType.AttachCount)
                {
                    AttachMent buildinAttach = mAttachMents[(int)attach.atype];
                    if (buildinAttach != null)
                    {
                        aVisual = buildinAttach.visual;
                    }
                }
                else
                {
                    aVisual = mVisual;
                }
                if (aVisual != null && aVisual is MeshVisual && aVisual.Visual != null)
                {
                    Transform tr = null;
                    if (string.IsNullOrEmpty(attach.socketname))
                    {
                        tr = aVisual.VisualTransform;
                    }
                    else
                    {
                        tr = (aVisual as MeshVisual).GetBoneByName(attach.socketname);
                        if (tr == null)
                        {
                            tr = aVisual.VisualTransform;
                        }
                    }

                    attach.parent = tr.gameObject;


                    EffectTableItem effectitem = DataManager.EffectTable[attach.resid] as EffectTableItem;

                    //不跟随释放者的特效,取挂点的方向
                    if (effectitem.notFollow && tr != null && attach.transform != null)
                    {
                        if (tr != null)
                        {
                            attach.transform.Rot = tr.rotation.eulerAngles;
                        }
                        else
                        {
                            attach.transform.Rot = Vector3.zero;
                        }
                    }
                }

                if (attach.parent != null)
                {
                    if (item.visual != null && item.visual.Visual != null)
                    {
                        item.visual.Visual.SetActive(true);
                    }
                    DressingRoom.AttachParticleTo(item, attach.parent.transform);
                }
            }
        }

        if (toDel != null)
        {
            foreach (ParticleAttachMent at in toDel)
            {
                mAttachParticles.Remove(at);
            }
        }
    }