예제 #1
0
        private void Build(object viewModel)
        {
            Content = new Frame
            {
                Content = new StackLayout
                {
                    // Dialog Content
                    Children =
                    {
                        new Image {
                            Source = Images.People
                        }.Center(),

                        new CollectionView
                        {
                            ItemTemplate = PersonTemplate.New(viewModel), SelectionMode = SelectionMode.None,

                            // FOOTER - Action
                            Footer = new ContentView
                            {
                                Content = new Button{
                                    ImageSource = Images.Add
                                }.Standard().Round(40).Center()
                                .Bind(nameof(MinuteViewModel.CreatePerson)),
                            },
                        }.VerticalListStyle().FillExpand()
                        .Assign(out CollectionView peopleCollection)
                        .Bind(CollectionView.ItemsSourceProperty, nameof(MinuteViewModel.People)),
                    }
                }
            }.Standard();
예제 #2
0
    public static PersonState InstantiatePersonFromTemplate(PersonTemplate template, string id = null)
    {
        PersonState state = new PersonState();

        state.id         = (id == null) ? Random.Range(0, int.MaxValue).ToString() : id;
        state.type       = template.type;
        state.name       = template.name;
        state.title      = template.title;
        state.speed      = template.speed;
        state.portraitId = template.portraitId;
        return(state);
    }
예제 #3
0
    public static void InitializePersonTemplates(JSONObject data)
    {
        List <PersonTemplate> people = new List <PersonTemplate>();

        foreach (JSONObject templateJson in data["people"].list)
        {
            PersonTemplate template = new PersonTemplate();
            template.id         = templateJson["id"].str;
            template.name       = templateJson["name"].str;
            template.title      = templateJson["title"].str;
            template.portraitId = templateJson["portraitId"].str;
            template.type       = (Unit.Type)Unit.Type.Parse(typeof(Unit.Type), templateJson["type"].str);
            template.speed      = templateJson["speed"].f;
            if (templateJson["initial_town"] != null)
            {
                template.initialTown = templateJson["initial_town"].str;
            }
            people.Add(template);
        }
        GameState.personTemplates = people.ToArray();
    }
예제 #4
0
        static void ConsoleStart()
        {
            Console.Clear();
            while (isMenu)
            {
                Console.WriteLine("Select num to\n 1 - Add\n 2 - Show\n 3 - Delete\n 4 - Exit");
                switch (Console.ReadKey().Key)
                {
                case ConsoleKey.D1:
                    Console.WriteLine("Input Name = ");
                    string name  = Console.ReadLine();
                    int    age   = ConsoleReadInt("Input Age = ");
                    double hours = ConsoleReadFloat("Input Hours = ");
                    string position;
                    string team;
                    Console.WriteLine("\nSelect position\n 1 - Back Dev\n 2 - Front Dev\n 3 - Jun");
                    switch (Console.ReadKey().Key)
                    {
                    case ConsoleKey.D1:
                        Console.Clear();
                        position = "Back Dev";
                        break;

                    case ConsoleKey.D2:
                        Console.Clear();
                        position = "Front Dev";
                        break;

                    default:
                        Console.Clear();
                        position = "Jun";
                        break;
                    }

                    Console.WriteLine("\nSelect team\n 1 - HG\n 2 - Plarium\n 3 - NoName");
                    switch (Console.ReadKey().Key)
                    {
                    case ConsoleKey.D1:
                        Console.Clear();
                        team = "HG";
                        break;

                    case ConsoleKey.D2:
                        Console.Clear();
                        team = "Plarium";
                        break;

                    default:
                        Console.Clear();
                        team = "NoName";
                        break;
                    }
                    var person = new PersonTemplate(name, age, position, team, hours);
                    ListCreator.Add(person);
                    TxtMethods.WriteTxT(person.ToString());
                    break;

                case ConsoleKey.D2:
                    Console.Clear();
                    double outHsHg = 0f;
                    double outHsPl = 0f;
                    double outHsDf = 0f;

                    foreach (var list in ListCreator.Acc)
                    {
                        if (list.team.Contains("HG"))
                        {
                            outHsHg += list.workHours;
                        }
                        else if (list.team.Contains("Plarium"))
                        {
                            outHsPl += list.workHours;
                        }
                        else
                        {
                            outHsDf += list.workHours;
                        }
                        Console.WriteLine($" Name = {list.name}, Age = {list.age}, Position = {list.position}, Team = {list.team}, WorkHours = {list.workHours}, Guid = {list.guidStr}\n");
                    }
                    Console.WriteLine($"HG works = {outHsHg} h, Plarium works = {outHsPl} h, Other works = {outHsDf} h ");
                    break;

                case ConsoleKey.D3:
                    Console.Clear();
                    Console.WriteLine("Input number Order");
                    int index = Convert.ToInt32(Console.ReadLine()) - 1;

                    if (index + 1 <= ListCreator.Acc.Count())
                    {
                        ListCreator.Acc.RemoveAt(index);
                    }
                    else
                    {
                        Console.WriteLine("Not found");
                    }
                    TxtMethods.ReCreateTxT();
                    foreach (var lines in ListCreator.Acc)
                    {
                        TxtMethods.WriteTxT(lines.ToString());
                    }
                    break;

                case ConsoleKey.D4:
                    isMenu = false;
                    break;
                }
            }
        }
예제 #5
0
    public static PersonState InstantiatePersonFromTemplate(string templateId, string id = null)
    {
        PersonTemplate template = GameState.GetPersonTemplate(templateId);

        return(GameState.InstantiatePersonFromTemplate(template, id));
    }