Example #1
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            int time_wait      = 0;
            int cur_task_index = 8;

            bool done_dialog = false;

            object[] time_msg_parametr_values = new object[2];
            time_msg_parametr_values[0] = TimerController.GetController().task9_timer;
            var     time_msg_param = new Yaga.CommonMessageParametr(time_msg_parametr_values);
            Message timer_msg      = new Message();

            timer_msg.Type      = MainScene.MainMenuMessageType.TASK_TIME_UPDATE;
            timer_msg.parametrs = time_msg_param;

            Task task = new Task(cur_task_index, 1, time_wait, 500, TextManager.getTaskName(9), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icon_007";

            var subs = new MessageSubscriber();

            subs.MessageTypes = new string[1] {
                MainScene.MainMenuMessageType.CLOSE_CUSTOMIZER_MISSIONS
            };
            subs.action = (m) =>
            {
                if (task.in_action)
                {
                    task.in_action = false;

                    Message new_msg = new Message();
                    new_msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    new_msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(new_msg);
                }
            };
            MessageBus.Instance.AddSubscriber(subs);

            task.BeforeCutScene = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };

            task.CutSceneCondition = () => { return(data.storable_data[6].done == true); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
            };


            task.DoneAction = () =>
            {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                //if(data.storable_data[7].done == false)
                //    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);

                MessageBus.Instance.SendMessage(new Message(BubbleAPI.OPEN,
                                                            new BubbleCreateParametr(
                                                                CatsMoveController.GetController().main_cat, new List <string>()
                {
                    TextManager.getText("bubble_relax")
                }, 5)));
            };

            task.DoneInitAction = () =>
            {
                MainLocationOjects.instance.tv_zone.SetActive(true);
            };

            task.TickAction = () =>
            {
                if (done_dialog)
                {
                    time_msg_parametr_values[1] = task.time_wait;
                    MessageBus.Instance.SendMessage(timer_msg);
                }
            };

            TaskAction tasc_action_1 = new TaskAction();

            tasc_action_1.action = () =>
            {
                MainLocationOjects.instance.tv_zone.SetActiveTrueWithAnimation();
                task.in_action = true;

                CatsMoveController.GetController().SetDestination(Cats.Main, "Point 23");
                List <Vector3> points = new List <Vector3>();
                Transform      point  = GameObject.Find("CameraTasksTargets").transform
                                        .Find("Living_room");
                points.Add(point.position);
                CameraMoveController.GetController().SetDestinations(points);

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_FOOTER);

                Message msg_cuts = new Message();
                msg_cuts.parametrs = new Yaga.CommonMessageParametr("Sofa");
                msg_cuts.Type      = MainScene.MainMenuMessageType.OPEN_CUSTOMIZER;
                MessageBus.Instance.SendMessage(msg_cuts);
            };
            tasc_action_1.condition_action = () => { return(true); };
            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);

            task.CheckActionConditions = () =>
            {
            };

            task.Idle = () =>
            {
            };

            task.DoneCondition = () =>
            {
                return(task.data.current_action_index >= task.TaskActions.Count);
            };

            return(task);
        }
Example #2
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            int time_wait      = 0;
            int cur_task_index = 10;

            Task task = new Task(cur_task_index, 2, time_wait, 0, TextManager.getTaskName(11), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icon_009";

            task.BeforeCutScene = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };

            task.CutSceneCondition = () => { return(data.storable_data[24].done == true); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
            };


            task.DoneAction = () =>
            {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.TOGGLE_MAIN_MENU_SOCIAL_BTN);
            };

            task.DoneInitAction = () =>
            {
            };

            TaskAction task_action_1 = new TaskAction();

            task_action_1.condition_action = () => { return(true); };
            task_action_1.action           = () =>
            {
                List <Vector3> points = new List <Vector3>();
                Transform      point  = GameObject.Find("CameraTasksTargets").transform
                                        .Find("Toliet");

                points.Add(point.position);

                CameraMoveController.GetController().SetDestinations(points);

                task.in_action = true;
            };

            TaskAction task_action_2 = new TaskAction();

            task_action_2.condition_action = () => { return(true); };
            task_action_2.action           = () =>
            {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.DRESS_DEFAULT_HOME_WALL);
                task.in_action = true;
            };

            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(task_action_1);
            task.TaskActions.Add(task_action_2);

            task.Idle = () =>
            {
            };

            float timer = -1.0f;

            task.CheckActionConditions = () =>
            {
                if (task.data.current_action_index == 0 && CameraMoveController.GetController().DoesReachDestination())
                {
                    Message msg = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);
                    task.in_action = false;
                }
                if (task.data.current_action_index == 1)
                {
                    if (timer == -1.0f)
                    {
                        timer = 1.5f;
                    }

                    timer -= Time.deltaTime;

                    if (timer <= 0.0f)
                    {
                        task.in_action = false;

                        Message msg = new Message();
                        msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                        msg.parametrs = new UpdateInt(task.index);
                        MessageBus.Instance.SendMessage(msg);
                    }
                }
            };


            task.DoneCondition = () =>
            {
                return(task.data.current_action_index >= task.TaskActions.Count);
            };

            return(task);
        }
Example #3
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            bool show_money_tutor = false;

            int time_wait      = 5 * 60;
            int cur_task_index = 6;

            object[] time_msg_parametr_values = new object[2];
            time_msg_parametr_values[0] = TimerController.GetController().task7_timer;
            var     time_msg_param = new Yaga.CommonMessageParametr(time_msg_parametr_values);
            Message timer_msg      = new Message();

            timer_msg.Type      = MainScene.MainMenuMessageType.TASK_TIME_UPDATE;
            timer_msg.parametrs = time_msg_param;

            bool dialog_end = false;

            Task task = new Task(cur_task_index, 1, time_wait, 0, TextManager.getTaskName(7), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icon_005";

            if (data.storable_data[cur_task_index].started)
            {
                servered_timer.GetTime("Task7",
                                       (answ) =>
                {
                    if (!task.data.done)
                    {
                        task.time_wait = answ.data.time;

                        time_msg_parametr_values[1] = task.time_wait;
                        MessageBus.Instance.SendMessage(timer_msg, true);

                        dialog_end = true;
                    }
                },
                                       (answ) =>
                {
                    //task.time_wait = time_wait;

                    //time_msg_parametr_values[1] = task.time_wait;
                    //MessageBus.Instance.SendMessage(timer_msg);
                });
            }



            task.BeforeCutScene = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };

            task.CutSceneCondition = () => { return(data.storable_data[4].done == true); };

            task.Init = () =>
            {
                if (!DataController.instance.tasks_storage.content.ContainsKey("show_coins_tutor"))
                {
                    DataController.instance.tasks_storage.content["show_coins_tutor"] = false;
                    DataController.instance.tasks_storage.Store();
                }

                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
                show_money_tutor = true;

                //var subs = new MessageSubscriber();
                //subs.MessageTypes = new string[3] { MainScene.MainMenuMessageType.CLOSE_TASK_LIST, "TASK_ITEM_OPENED",
                //    MainScene.MainMenuMessageType.OPEN_MINI_GAMES };
                //subs.action = (m) =>
                //{
                //    if (m.Type == MainScene.MainMenuMessageType.OPEN_MINI_GAMES)
                //    {
                //        show_money_tutor = false;
                //        return;
                //    }

                //    if (m.Type == MainScene.MainMenuMessageType.CLOSE_TASK_LIST &&
                //    task.data.started)
                //        return;

                //    if (m.Type == "TASK_ITEM_OPENED" &&
                //    !task.data.started)
                //        return;

                //    if(!show_money_tutor && m.Type == MainScene.MainMenuMessageType.CLOSE_TASK_LIST)
                //        return;

                //    if (DataController.instance.gamesRecords.StarMinigameNeed)
                //        return;

                //    if (!(bool)DataController.instance.tasks_storage.content["show_coins_tutor"])
                //    {
                //        DataController.instance.tasks_storage.content["show_coins_tutor"] = true;
                //        DataController.instance.tasks_storage.Store();

                //        List<DialogEntity> deList = new List<DialogEntity>();
                //        deList.Add(new DialogEntity(
                //            TextManager.getDialogsText(7, 3), DialogType.Black, DialogType.Main, DialogEntity.get_id(7, 3)));
                //        dialog.SetDialogs(deList);
                //        dialog.SetBtnAction(() =>
                //        {
                //            dialog.CloseDialog();

                //            MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                //            MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_MINI_GAMES);
                //            MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_COINS_GAMES);

                //            MessageBus.Instance.SendMessage(new Message(TutorMaskController.Messages.SHOW_TUTOR_MASK,
                //                    new TutorMaskController.TutorMaskParametr(
                //                        MainLocationOjects.instance.minigames_play_coins_btn.GetComponent<RectTransform>().anchoredPosition, true, true,
                //                        "minigames_play_coins_btn")));
                //        });
                //        MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_TASK_LIST);
                //        dialog.ShowDialog();
                //        MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
                //    }
                //};
                //MessageBus.Instance.AddSubscriber(subs);
            };


            task.DoneAction = () =>
            {
                task.in_action = true;

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);
            };

            task.DoneInitAction = () =>
            {
                MainLocationOjects.instance.trash_pack.SetActive(false);
            };


            task.TickAction = () =>
            {
                if (dialog_end)
                {
                    time_msg_parametr_values[1] = task.time_wait;
                    MessageBus.Instance.SendMessage(timer_msg);
                }
            };


            TaskAction tasc_action_1 = new TaskAction();

            tasc_action_1.action = () =>
            {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(7, 1), DialogType.Main, DialogType.One, DialogEntity.get_id(7, 1)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();
                    //task.in_action = false;

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);
                    //timer

                    task.speed_up_price = (int)(DataController.instance.catsPurse.Coins * 0.9f);

                    MessageBus.Instance.SendMessage(
                        new Message(TutorMaskController.Messages.SHOW_TUTOR_MASK,
                                    new TutorMaskController.TutorMaskParametr(
                                        MainLocationOjects.instance.taks_1_btn.GetComponent <RectTransform>().anchoredPosition, true, true,
                                        "task_list_task1_btn")));

                    time_msg_parametr_values[1] = task.time_wait;
                    MessageBus.Instance.SendMessage(timer_msg);

                    servered_timer.SetTime("Task7", task.time_wait);

                    dialog_end = true;
                });
                dialog.ShowDialog();
                task.in_action = true;

                CatsMoveController.GetController().SetDestination(Cats.Main, "Point 25");
                CatsMoveController.GetController().SetDestination(Cats.Black, "Point 7");

                List <Vector3> points = new List <Vector3>();
                Transform      point  = GameObject.Find("CameraTasksTargets").transform
                                        .Find("Trash_packeg");
                points.Add(point.position);
                CameraMoveController.GetController().SetDestinations(points);
            };
            tasc_action_1.condition_action = () => { return(true); };

            task.CheckActionConditions = () =>
            {
                if (task.data.current_action_index == 0)
                {
                    if (CameraMoveController.GetController().DoesReachDestination())
                    {
                        task.in_action = false;

                        Message msg = new Message();
                        msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                        msg.parametrs = new UpdateInt(task.index);
                        MessageBus.Instance.SendMessage(msg);
                    }
                }

                else if (task.data.current_action_index == 1 && task.time_wait < 0.0f)
                {
                    task.in_action = false;

                    Message msg = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);
                }

                else if (task.data.current_action_index == 2 && GarbageTruckController.GetController().end_garbage_timer <= 0.0f)
                {
                    task.in_action = false;

                    Message msg = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                }
            };


            TaskAction tasc_action_2 = new TaskAction();

            tasc_action_2.condition_action = () => { return(task.time_wait < 0.0f); };
            tasc_action_2.action           = () =>
            {
                List <Vector3> points = new List <Vector3>();
                Transform      point  = GameObject.Find("CameraTasksTargets").transform
                                        .Find("Trash_packeg");
                points.Add(point.position);
                CameraMoveController.GetController().SetDestinations(points);
                task.in_action = true;
            };

            TaskAction tasc_action_3 = new TaskAction();

            tasc_action_3.condition_action = () => { return(true); };
            tasc_action_3.action           = () =>
            {
                MainLocationOjects.instance.GarbageTruckController.SetActive(true);
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_FOOTER);

                task.in_action = true;
            };

            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);
            task.TaskActions.Add(tasc_action_2);
            task.TaskActions.Add(tasc_action_3);

            task.Idle = () =>
            {
            };

            task.DoneCondition = () =>
            {
                return(task.data.current_action_index >= task.TaskActions.Count);
            };

            return(task);
        }
Example #4
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            int time_wait      = 0;
            int cur_task_index = 19;

            Task task = new Task(cur_task_index, 2, time_wait, 0, TextManager.getTaskName(20), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icon_018";

            task.BeforeCutScene = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };

            task.CutSceneCondition = () => { return(data.storable_data[18].done == true); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
            };


            task.DoneAction = () =>
            {
                task.in_action = true;

                MainLocationOjects.instance.garden1_bushes.SetActiveTrueWithAnimation();

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(20, 1), DialogType.Black, DialogType.Main, DialogEntity.get_id(20, 1)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(20, 2), DialogType.Main, DialogType.Black, DialogEntity.get_id(20, 2)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_FOOTER);
                    //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);

                    Message m;
                    m.Type      = MainScene.MainMenuMessageType.OPEN_CUSTOMIZER;
                    m.parametrs = new Yaga.CommonMessageParametr("garden");
                    MessageBus.Instance.SendMessage(m);

                    MessageBus.Instance.SendMessage(new Message(BubbleAPI.OPEN,
                                                                new BubbleCreateParametr(
                                                                    CatsMoveController.GetController().main_cat, new List <string>()
                    {
                        TextManager.getText("bubble_joy")
                    }, 5)));

                    dialog.CloseDialog();
                });

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
                dialog.ShowDialog();
            };

            task.DoneInitAction = () =>
            {
                MainLocationOjects.instance.garden1_bushes.SetActive(true);
            };

            TaskAction tasc_action_1 = new TaskAction();

            task.CheckActionConditions = () =>
            {
                if (task.data.current_action_index == 0 && CatsMoveController.GetController().DoesCatReachDestination(Cats.Main))
                {
                    task.in_action = false;

                    Message msg = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);
                }
            };

            tasc_action_1.action = () =>
            {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
                CatsMoveController.GetController().SetDestination(Cats.Main, "Point 70");
                CatsMoveController.GetController().SetDestination(Cats.Black, "Point 77");
                CameraMoveController.GetController().SetDestinations("CameraTasksTargets", "Garden_1");
                task.in_action = true;
            };
            tasc_action_1.condition_action = () => { return(true); };

            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);

            task.Idle = () =>
            {
            };

            task.DoneCondition = () =>
            {
                return(task.data.current_action_index >= task.TaskActions.Count);
            };

            return(task);
        }
Example #5
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            Task task = new Task(4, 1, 0, 0, TextManager.getTaskName(5), true, false);

            task.data = data.storable_data[4];

            task.icon_name = "task_icon_004";

            var subs = new MessageSubscriber();

            subs.MessageTypes = new string[1] {
                MainScene.MainMenuMessageType.CLOSE_CUSTOMIZER_MISSIONS
            };
            subs.action = (m) =>
            {
                if (task.in_action)
                {
                    task.in_action = false;

                    Message new_msg = new Message();
                    new_msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    new_msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(new_msg);
                }
            };
            MessageBus.Instance.AddSubscriber(subs);

            task.BeforeCutScene = () =>
            {
                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(4, 1), DialogType.Main, DialogType.Black, DialogEntity.get_id(4, 1)));
                dialog.SetDialogs(deList);
                dialog.SetMissionIcon(task.icon_name);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();

                    Message msg   = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                    //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);
                });
                dialog.ShowDialog();
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_TASK_LIST);
            };

            task.CutSceneCondition = () => { return(data.storable_data[3].done == true); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
            };


            task.DoneAction = () =>
            {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);
            };

            task.DoneInitAction = () =>
            {
                // MainLocationOjects.instance.kitchen.SetActive(true);
            };

            TaskAction task_action_1 = new TaskAction();

            task_action_1.condition_action = () => { return(true); };
            task_action_1.action           = () =>
            {
                List <Vector3> points = new List <Vector3>();
                Transform      point  = GameObject.Find("CameraTasksTargets").transform
                                        .Find("Kitchen");

                points.Add(point.position);

                CameraMoveController.GetController().SetDestinations(points);

                task.in_action = true;

                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.OPEN_CUSTOMIZER;
                msg.parametrs = new Yaga.CommonMessageParametr("Wall_Kitchen");
                MessageBus.Instance.SendMessage(msg);

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_FOOTER);
            };

            TaskAction task_action_2 = new TaskAction();

            task_action_2.condition_action = () => { return(true); };
            task_action_2.action           = () =>
            {
                task.in_action = true;

                var cust_subs = new MessageSubscriber();
                cust_subs.MessageTypes = new string[1] {
                    MainScene.MainMenuMessageType.OPEN_CUSTOMIZER_WITH_CLOSE
                };
                cust_subs.action = (m) =>
                {
                    if (task.in_action)
                    {
                        GameStatistics.instance.SendStat("tutor_pressed_double_tap_customize", 0);

                        MainLocationOjects.instance.arrow_kitchen.SetActive(false);
                        MainLocationOjects.instance.customize_info_tutor.SetActive(false);
                    }
                };
                MessageBus.Instance.AddSubscriber(cust_subs);

                var cust_subs2 = new MessageSubscriber();
                cust_subs2.MessageTypes = new string[1] {
                    MainScene.MainMenuMessageType.CLOSE_CUSTOMIZER_MISSIONS
                };
                cust_subs2.action = (m) =>
                {
                    if (task.in_action)
                    {
                        task.in_action = false;

                        Message new_msg = new Message();
                        new_msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                        new_msg.parametrs = new UpdateInt(task.index);
                        MessageBus.Instance.SendMessage(new_msg);
                    }
                };
                MessageBus.Instance.AddSubscriber(cust_subs2);

                List <Vector3> points = new List <Vector3>();
                Transform      point  = GameObject.Find("CameraTasksTargets").transform
                                        .Find("Kitchen");

                points.Add(point.position);

                CameraMoveController.GetController().SetDestinations(points);

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(4, 2), DialogType.Black, DialogType.Main, DialogEntity.get_id(4, 2)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);

                    MainLocationOjects.instance.arrow_kitchen.SetActive(true);
                    MainLocationOjects.instance.customize_info_tutor.SetActive(true);
                });
                dialog.ShowDialog();
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
            };

            TaskAction task_action_3 = new TaskAction();

            task_action_3.condition_action = () => { return(true); };
            task_action_3.action           = () =>
            {
                task.in_action = true;

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(4, 3), DialogType.Main, DialogType.One, DialogEntity.get_id(4, 3)));
                dialog.SetMissionIcon("task_icon_005");
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();

                    task.in_action = false;

                    Message new_msg   = new Message();
                    new_msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    new_msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(new_msg);

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                });
                dialog.ShowDialog();
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
            };

            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(task_action_1);
            task.TaskActions.Add(task_action_2);
            task.TaskActions.Add(task_action_3);

            task.Idle = () =>
            {
            };

            task.CheckActionConditions = () =>
            {
            };

            task.DoneCondition = () =>
            {
                return(task.data.current_action_index >= task.TaskActions.Count);
            };

            return(task);
        }
Example #6
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            int time_wait      = 15 * 60;
            int cur_task_index = 14;

            object[] time_msg_parametr_values = new object[2];
            time_msg_parametr_values[0] = TimerController.GetController().task15_timer;
            var     time_msg_param = new Yaga.CommonMessageParametr(time_msg_parametr_values);
            Message timer_msg      = new Message();

            timer_msg.Type      = MainScene.MainMenuMessageType.TASK_TIME_UPDATE;
            timer_msg.parametrs = time_msg_param;

            Task task = new Task(cur_task_index, 1, time_wait, 500, TextManager.getTaskName(15), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icon_013";

            if (data.storable_data[cur_task_index].started)
            {
                servered_timer.GetTime("Task15",
                                       (answ) =>
                {
                    if (!task.data.done)
                    {
                        task.time_wait = answ.data.time;

                        time_msg_parametr_values[1] = task.time_wait;
                        MessageBus.Instance.SendMessage(timer_msg, true);
                    }
                },
                                       (answ) =>
                {
                    //todo replay request
                });
            }

            task.BeforeCutScene = () =>
            {
                //List<DialogEntity> deList = new List<DialogEntity>();
                //deList.Add(new DialogEntity(
                //    TextManager.getDialogsText(13, 1), DialogType.Black, DialogType.One, DialogEntity.get_id(13, 1)));
                //dialog.SetDialogs(deList);
                //dialog.SetBtnAction(() =>
                //{
                //    dialog.CloseDialog();

                //    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);

                //    MessageBus.Instance.SendMessage(new Message(TutorMaskController.Messages.SHOW_TUTOR_MASK,
                //        new TutorMaskController.TutorMaskParametr(
                //            MainLocationOjects.instance.minigames_btn_footer.transform.position, false, true,
                //            "minigames_btn_footer")));

                //    MessageBus.Instance.SendMessage(new Message(TutorMaskController.Messages.SHOW_TUTOR_MASK,
                //        new TutorMaskController.TutorMaskParametr(
                //            MainLocationOjects.instance.minigames_play_star_btn.GetComponent<RectTransform>().anchoredPosition, true, false,
                //            "minigames_play_star_btn")));

                //    DataController.instance.tasks_storage.content["minigame_reborn_tutor"] = true;
                //    DataController.instance.tasks_storage.Store();

                //    Message msg = new Message();
                //    msg.Type = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                //    msg.parametrs = new UpdateInt(task.index);
                //    MessageBus.Instance.SendMessage(msg);

                //    BoosterPrize prize = new BoosterPrize(BusterType.REBORN, 3);
                //    prize.ActiveAction();

                //    task.in_action = false;
                //});
                //dialog.ShowDialog();

                //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_TASK_LIST);
                //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
                //task.in_action = true;
            };

            task.CutSceneCondition = () => { return(data.storable_data[13].done == true); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
            };


            task.DoneAction = () =>
            {
                task.in_action = true;

                MainLocationOjects.instance.Children_obstruction.SetActive(false);
                MainLocationOjects.instance.Children_boxes.SetActiveTrueWithAnimation();

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(15, 1), DialogType.Black, DialogType.One, DialogEntity.get_id(15, 1)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(15, 2), DialogType.Djeki, DialogType.Black, DialogEntity.get_id(15, 2)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    List <DialogEntity> deList2 = new List <DialogEntity>();
                    deList2.Add(new DialogEntity(
                                    TextManager.getDialogsText(15, 3), DialogType.Main, DialogType.Black, DialogEntity.get_id(15, 3)));
                    deList2.Add(new DialogEntity(
                                    TextManager.getDialogsText(15, 4), DialogType.Black, DialogType.Main, DialogEntity.get_id(15, 4)));
                    deList2.Add(new DialogEntity(
                                    TextManager.getDialogsText(15, 5), DialogType.Main, DialogType.Black, DialogEntity.get_id(15, 5)));
                    dialog.SetDialogs(deList2);
                    dialog.SetMissionIcon("task_icon_014");
                    dialog.SetMissionIcon("task_icon_015");
                    dialog.SetMissionIcon("task_icon_016");

                    dialog.SetBtnAction(() =>
                    {
                        task.in_action = false;
                        dialog.CloseDialog();
                        MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                        MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);
                    });

                    CatsMoveController.GetController().SetDestination(Cats.Jakky, "Point 64");
                    CatsMoveController.GetController().SetDestination(Cats.Main, "Point 76");
                    CatsMoveController.GetController().SetDestination(Cats.Black, "Point 75");

                    CameraMoveController.GetController().SetDestinations("CameraTasksTargets", "Garden_1");
                    //CatsMoveController.GetController().SetDestination(Cats.Black, "CatTasksTargets", "Task15", "BlackTargets2");
                });
                dialog.ShowDialog();

                //CatsMoveController.GetController().SetDestination(Cats.Black, "CatTasksTargets", "Task15", "BlackTargets");
                //CatsMoveController.GetController().SetDestination(Cats.Main, "CatTasksTargets", "Task15", "MainTargets");
                //CatsMoveController.GetController().SetDestination(Cats.Jakky, "CatTasksTargets", "Task15", "JakkyTargets");

                CameraMoveController.GetController().SetDestinations("CameraTasksTargets", "Child_room");

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);

                TimerController.GetController().task15_timer.SetActive(false);
                MainLocationOjects.instance.Children_obstruction_farm.SetActive(false);
            };

            task.DoneInitAction = () =>
            {
                MainLocationOjects.instance.Children_obstruction.SetActive(false);
                MainLocationOjects.instance.Children_obstruction_farm.SetActive(false);
                MainLocationOjects.instance.Children_boxes.SetActive(true);
            };


            task.TickAction = () =>
            {
                time_msg_parametr_values[1] = task.time_wait;
                MessageBus.Instance.SendMessage(timer_msg);
            };

            TaskAction tasc_action_1 = new TaskAction();

            tasc_action_1.action = () =>
            {
                time_msg_parametr_values[1] = task.time_wait;
                MessageBus.Instance.SendMessage(timer_msg);

                servered_timer.SetTime("Task15", task.time_wait);

                CameraMoveController.GetController().SetDestinations("CameraTasksTargets", "Child_room");

                CatsMoveController.GetController().SetDestination(Cats.Main, "Point 59");
                CatsMoveController.GetController().SetDestination(Cats.Black, "Point 22");

                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };

            tasc_action_1.condition_action = () => { return(true); };

            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);

            task.Idle = () =>
            {
                if (task.data.started && !task.data.done && !MainLocationOjects.instance.Children_obstruction_farm.activeSelf &&
                    task.data.current_action_index > 0)
                {
                    MainLocationOjects.instance.Children_obstruction_farm.SetActive(true);
                    MainLocationOjects.instance.Children_obstruction.SetActive(false);
                }
            };

            task.DoneCondition = () =>
            {
                return(task.time_wait < 0);
            };

            return(task);
        }
Example #7
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            int time_wait      = 10 * 60;
            int cur_task_index = 21;

            object[] time_msg_parametr_values = new object[2];
            time_msg_parametr_values[0] = TimerController.GetController().task22_timer;
            var     time_msg_param = new Yaga.CommonMessageParametr(time_msg_parametr_values);
            Message timer_msg      = new Message();

            timer_msg.Type      = MainScene.MainMenuMessageType.TASK_TIME_UPDATE;
            timer_msg.parametrs = time_msg_param;

            Task task = new Task(cur_task_index, 2, time_wait, 1000, TextManager.getTaskName(22), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icon_020";

            if (data.storable_data[cur_task_index].started)
            {
                servered_timer.GetTime("Task22",
                                       (answ) =>
                {
                    if (!task.data.done)
                    {
                        task.time_wait = answ.data.time;

                        time_msg_parametr_values[1] = task.time_wait;
                        MessageBus.Instance.SendMessage(timer_msg, true);
                    }
                },
                                       (answ) =>
                {
                    //todo replay request
                });
            }

            task.BeforeCutScene = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };

            task.CutSceneCondition = () => { return(data.storable_data[18].done == true); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
            };


            task.DoneAction = () =>
            {
                task.in_action = true;

                MainLocationOjects.instance.garden2_staf.SetActiveTrueWithAnimation();

                CatsMoveController.GetController().SetDestination(Cats.Main, "Point 40");
                CatsMoveController.GetController().SetDestination(Cats.Black, "Point 45");
                CameraMoveController.GetController().SetDestinations("CameraTasksTargets", "Saray");

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(22, 1), DialogType.Main, DialogType.One, DialogEntity.get_id(22, 1)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                    //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);

                    MessageBus.Instance.SendMessage(new Message(BubbleAPI.OPEN,
                                                                new BubbleCreateParametr(
                                                                    CatsMoveController.GetController().main_cat, new List <string>()
                    {
                        TextManager.getText("bubble_game")
                    }, 5)));

                    dialog.CloseDialog();
                });

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
                dialog.ShowDialog();

                TimerController.GetController().task22_timer.SetActive(false);
                MainLocationOjects.instance.garden2_staf_farm.SetActive(false);
            };

            task.DoneInitAction = () =>
            {
                MainLocationOjects.instance.garden2_staf.SetActive(true);
                MainLocationOjects.instance.garden2_staf_farm.SetActive(false);
            };

            task.TickAction = () =>
            {
                time_msg_parametr_values[1] = task.time_wait;
                MessageBus.Instance.SendMessage(timer_msg);
            };

            TaskAction tasc_action_1 = new TaskAction();

            tasc_action_1.action = () =>
            {
                servered_timer.SetTime("Task22", task.time_wait);

                time_msg_parametr_values[1] = task.time_wait;
                MessageBus.Instance.SendMessage(timer_msg);

                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);

                //MainLocationOjects.instance.Children_zone.SetActive(true);
                //new cats
            };
            tasc_action_1.condition_action = () => { return(true); };

            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);

            task.Idle = () =>
            {
                if (task.data.started && !task.data.done && !MainLocationOjects.instance.garden2_staf_farm.activeSelf &&
                    task.data.current_action_index > 0)
                {
                    MainLocationOjects.instance.garden2_staf_farm.SetActive(true);
                }
            };

            task.DoneCondition = () =>
            {
                return(task.time_wait < 0);
            };

            return(task);
        }
Example #8
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            int time_wait      = 30 * 60;
            int cur_task_index = 17;

            object[] time_msg_parametr_values = new object[2];
            time_msg_parametr_values[0] = TimerController.GetController().task18_timer;
            var     time_msg_param = new Yaga.CommonMessageParametr(time_msg_parametr_values);
            Message timer_msg      = new Message();

            timer_msg.Type      = MainScene.MainMenuMessageType.TASK_TIME_UPDATE;
            timer_msg.parametrs = time_msg_param;

            bool done_dialog = false;

            Task task = new Task(cur_task_index, 1, time_wait, 3000, TextManager.getTaskName(18), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icon_016";

            if (data.storable_data[cur_task_index].started)
            {
                servered_timer.GetTime("Task18",
                                       (answ) =>
                {
                    if (!task.data.done)
                    {
                        task.time_wait = answ.data.time;

                        time_msg_parametr_values[1] = task.time_wait;
                        MessageBus.Instance.SendMessage(timer_msg, true);

                        done_dialog = true;
                    }
                },
                                       (answ) =>
                {
                    //todo replay request
                });
            }

            task.BeforeCutScene = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };

            task.CutSceneCondition = () => { return(data.storable_data[14].done == true); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
            };


            task.DoneAction = () =>
            {
                MainLocationOjects.instance.music.SetActiveTrueWithAnimation();

                List <Vector3> points_main3 = new List <Vector3>();
                Transform      point        = GameObject.Find("CameraTasksTargets")
                                              .transform.Find("Music");
                points_main3.Add(point.position);
                CameraMoveController.GetController().SetDestinations(points_main3);

                MessageBus.Instance.SendMessage(new Message(BubbleAPI.OPEN,
                                                            new BubbleCreateParametr(
                                                                CatsMoveController.GetController().main_cat, new List <string>()
                {
                    TextManager.getText("bubble_books")
                }, 5)));

                //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);

                TimerController.GetController().task18_timer.SetActive(false);
                MainLocationOjects.instance.music_farm.SetActive(false);
            };

            task.DoneInitAction = () =>
            {
                MainLocationOjects.instance.music.SetActive(true);
                MainLocationOjects.instance.music_farm.SetActive(false);
                //new cats
            };

            task.TickAction = () =>
            {
                if (done_dialog)
                {
                    time_msg_parametr_values[1] = task.time_wait;
                    MessageBus.Instance.SendMessage(timer_msg);
                }
            };

            TaskAction tasc_action_1 = new TaskAction();

            tasc_action_1.action = () =>
            {
                List <Vector3> points_main3 = new List <Vector3>();
                Transform      point        = GameObject.Find("CameraTasksTargets")
                                              .transform.Find("Music");
                points_main3.Add(point.position);
                CameraMoveController.GetController().SetDestinations(points_main3);

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(18, 1), DialogType.Black, DialogType.Main, DialogEntity.get_id(18, 1)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(18, 2), DialogType.Main, DialogType.Black, DialogEntity.get_id(18, 2)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();
                    task.in_action = false;

                    Message msg   = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);

                    servered_timer.SetTime("Task18", task.time_wait);
                    MainLocationOjects.instance.music_farm.SetActive(true);

                    time_msg_parametr_values[1] = task.time_wait;
                    MessageBus.Instance.SendMessage(timer_msg);

                    done_dialog = true;
                });
                dialog.ShowDialog();

                task.in_action = true;
            };
            tasc_action_1.condition_action = () => { return(true); };


            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);

            task.Idle = () =>
            {
                if (task.data.started && !task.data.done && !MainLocationOjects.instance.music_farm.activeSelf &&
                    task.data.current_action_index > 0)
                {
                    MainLocationOjects.instance.music_farm.SetActive(true);
                }
            };

            task.DoneCondition = () =>
            {
                return(task.time_wait < 0);
            };

            return(task);
        }
Example #9
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            int time_wait      = 30 * 60;
            int cur_task_index = 12;

            object[] time_msg_parametr_values = new object[2];
            time_msg_parametr_values[0] = TimerController.GetController().task13_timer;
            var     time_msg_param = new Yaga.CommonMessageParametr(time_msg_parametr_values);
            Message timer_msg      = new Message();

            timer_msg.Type      = MainScene.MainMenuMessageType.TASK_TIME_UPDATE;
            timer_msg.parametrs = time_msg_param;

            Task task = new Task(cur_task_index, 1, time_wait, 3000, TextManager.getTaskName(13), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icon_011";

            if (data.storable_data[cur_task_index].started)
            {
                servered_timer.GetTime("Task13",
                                       (answ) =>
                {
                    if (!task.data.done)
                    {
                        task.time_wait = answ.data.time;

                        time_msg_parametr_values[1] = task.time_wait;
                        MessageBus.Instance.SendMessage(timer_msg, true);
                    }
                },
                                       (answ) =>
                {
                    //todo replay request
                });
            }

            task.BeforeCutScene = () =>
            {
                //List<DialogEntity> deList = new List<DialogEntity>();
                //deList.Add(new DialogEntity(
                //    TextManager.getDialogsText(13, 1), DialogType.Black, DialogType.One, DialogEntity.get_id(13, 1)));
                //dialog.SetDialogs(deList);
                //dialog.SetBtnAction(() =>
                //{
                //    dialog.CloseDialog();

                //    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);

                //    MessageBus.Instance.SendMessage(new Message(TutorMaskController.Messages.SHOW_TUTOR_MASK,
                //        new TutorMaskController.TutorMaskParametr(
                //            MainLocationOjects.instance.minigames_btn_footer.transform.position, false, true,
                //            "minigames_btn_footer")));

                //    MessageBus.Instance.SendMessage(new Message(TutorMaskController.Messages.SHOW_TUTOR_MASK,
                //        new TutorMaskController.TutorMaskParametr(
                //            MainLocationOjects.instance.minigames_play_star_btn.GetComponent<RectTransform>().anchoredPosition, true, false,
                //            "minigames_play_star_btn")));

                //    DataController.instance.tasks_storage.content["minigame_fly_tutor"] = true;
                //    DataController.instance.tasks_storage.Store();

                //    Message msg = new Message();
                //    msg.Type = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                //    msg.parametrs = new UpdateInt(task.index);
                //    MessageBus.Instance.SendMessage(msg);

                //    BoosterPrize prize = new BoosterPrize(BusterType.FLY, 3);
                //    prize.ActiveAction();

                //    task.in_action = false;
                //});
                //dialog.ShowDialog();

                //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_TASK_LIST);
                //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
                //task.in_action = true;
            };

            task.CutSceneCondition = () =>
            {
                return(data.storable_data[11].done == true);
            };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () =>
            {
            };


            task.DoneAction = () =>
            {
                List <Vector3> points_main2 = new List <Vector3>();
                Transform      point        = GameObject.Find("CameraTasksTargets").transform
                                              .Find("Sleeping_room");
                points_main2.Add(point.position);
                CameraMoveController.GetController().SetDestinations(points_main2);

                MainLocationOjects.instance.sleep_room.SetActiveTrueWithAnimation();

                MessageBus.Instance.SendMessage(new Message(BubbleAPI.OPEN,
                                                            new BubbleCreateParametr(
                                                                CatsMoveController.GetController().main_cat, new List <string>()
                {
                    TextManager.getText("bubble_relax")
                }, 5)));

                //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);

                TimerController.GetController().task13_timer.SetActive(false);
                MainLocationOjects.instance.sleep_room_farm.SetActive(false);
            };

            task.DoneInitAction = () =>
            {
                MainLocationOjects.instance.sleep_room.SetActive(true);
                MainLocationOjects.instance.sleep_room_farm.SetActive(false);
            };

            task.CheckActionConditions = () => { };

            task.TickAction = () =>
            {
                time_msg_parametr_values[1] = task.time_wait;
                MessageBus.Instance.SendMessage(timer_msg);
            };

            TaskAction tasc_action_1 = new TaskAction();

            tasc_action_1.action = () =>
            {
                time_msg_parametr_values[1] = task.time_wait;
                MessageBus.Instance.SendMessage(timer_msg);

                servered_timer.SetTime("Task13", task.time_wait);
                MainLocationOjects.instance.sleep_room_farm.SetActive(true);

                List <Vector3> points_main2 = new List <Vector3>();
                Transform      point        = GameObject.Find("CameraTasksTargets").transform
                                              .Find("Sleeping_room");
                points_main2.Add(point.position);
                CameraMoveController.GetController().SetDestinations(points_main2);

                CatsMoveController.GetController().SetDestination(Cats.Main, "Point 26");

                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };
            tasc_action_1.condition_action = () => { return(true); };


            TaskAction tasc_action_2 = new TaskAction();

            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);

            task.Idle = () =>
            {
                if (task.data.started && !task.data.done && !MainLocationOjects.instance.sleep_room_farm.activeSelf &&
                    task.data.current_action_index > 0)
                {
                    MainLocationOjects.instance.sleep_room_farm.SetActive(true);
                }
            };

            task.DoneCondition = () =>
            {
                return(task.time_wait < 0);
            };

            return(task);
        }
Example #10
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            int time_wait      = 0;
            int cur_task_index = 22;

            Task task = new Task(cur_task_index, 1, time_wait, 0, TextManager.getTaskName(23), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icon_021";

            task.BeforeCutScene = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };

            task.CutSceneCondition = () => { return(data.storable_data[18].done == true); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
            };


            task.DoneAction = () =>
            {
                task.in_action = true;

                MainLocationOjects.instance.garden1_benches.SetActiveTrueWithAnimation();
                //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_FOOTER);
                //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);

                Message m;
                m.Type      = MainScene.MainMenuMessageType.OPEN_CUSTOMIZER;
                m.parametrs = new Yaga.CommonMessageParametr("bench");
                MessageBus.Instance.SendMessage(m);
            };

            task.DoneInitAction = () =>
            {
                MainLocationOjects.instance.garden1_benches.SetActive(true);
            };


            task.CheckActionConditions = () =>
            {
                if (task.data.current_action_index == 0 && CameraMoveController.GetController().DoesReachDestination())
                {
                    task.in_action = false;

                    Message msg = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);
                }
            };

            TaskAction tasc_action_1 = new TaskAction();

            tasc_action_1.action = () =>
            {
                CameraMoveController.GetController().SetDestinations("CameraTasksTargets", "Garden_1");
                task.in_action = true;
            };
            tasc_action_1.condition_action = () => { return(true); };

            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);

            task.Idle = () =>
            {
            };

            task.DoneCondition = () =>
            {
                return(task.data.current_action_index >= task.TaskActions.Count);
            };

            return(task);
        }
Example #11
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            int time_wait      = 0;
            int cur_task_index = 7;

            Task task = new Task(cur_task_index, 1, time_wait, 500, TextManager.getTaskName(8), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icon_006";

            var subs = new MessageSubscriber();

            subs.MessageTypes = new string[1] {
                MainScene.MainMenuMessageType.CLOSE_CUSTOMIZER_MISSIONS
            };
            subs.action = (m) =>
            {
                if (task.in_action)
                {
                    task.in_action = false;

                    Message new_msg = new Message();
                    new_msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    new_msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(new_msg);
                }
            };
            MessageBus.Instance.AddSubscriber(subs);

            task.BeforeCutScene = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };

            task.CutSceneCondition = () => { return(data.storable_data[6].done == true); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
            };

            task.CheckActionConditions = () => { };


            task.DoneAction = () =>
            {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                if (data.storable_data[8].done == false)
                {
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);
                }
                else
                {
                    MessageBus.Instance.SendMessage(new Message(BubbleAPI.OPEN,
                                                                new BubbleCreateParametr(
                                                                    CatsMoveController.GetController().main_cat, new List <string>()
                    {
                        TextManager.getText("bubble_soft_floor")
                    }, 5)));
                }
            };

            task.DoneInitAction = () =>
            {
            };

            TaskAction tasc_action_1 = new TaskAction();

            tasc_action_1.action = () =>
            {
                task.in_action = true;

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_FOOTER);
                Message msg_cuts = new Message();
                msg_cuts.parametrs = new Yaga.CommonMessageParametr("Floor_Home");
                msg_cuts.Type      = MainMenuMessageType.OPEN_CUSTOMIZER;
                MessageBus.Instance.SendMessage(msg_cuts);

                CatsMoveController.GetController().SetDestination(Cats.Main, "Point 23");
                CatsMoveController.GetController().SetDestination(Cats.Black, "Point 7");
                CameraMoveController.GetController().SetDestinations("CameraTasksTargets", "Home");
            };
            tasc_action_1.condition_action = () => { return(true); };

            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);

            task.Idle = () =>
            {
            };

            task.DoneCondition = () =>
            {
                return(task.data.current_action_index >= task.TaskActions.Count);
            };

            return(task);
        }
Example #12
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            int time_wait      = 10 * 60;
            int cur_task_index = 11;

            object[] time_msg_parametr_values = new object[2];
            time_msg_parametr_values[0] = TimerController.GetController().task12_timer;
            var     time_msg_param = new Yaga.CommonMessageParametr(time_msg_parametr_values);
            Message timer_msg      = new Message();

            timer_msg.Type      = MainScene.MainMenuMessageType.TASK_TIME_UPDATE;
            timer_msg.parametrs = time_msg_param;

            Task task = new Task(cur_task_index, 1, time_wait, 1000, TextManager.getTaskName(12), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icon_010";

            if (data.storable_data[cur_task_index].started)
            {
                servered_timer.GetTime("Task12",
                                       (answ) =>
                {
                    if (!task.data.done)
                    {
                        task.time_wait = answ.data.time;

                        time_msg_parametr_values[1] = task.time_wait;
                        MessageBus.Instance.SendMessage(timer_msg, true);
                    }
                },
                                       (answ) =>
                {
                    //todo replay request
                });
            }

            task.BeforeCutScene = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };

            task.CutSceneCondition = () => { return(data.storable_data[24].done == true); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
            };


            bool task_done = false;

            task.DoneAction = () =>
            {
                MainLocationOjects.instance.obstruction_toilet.SetActive(false);

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(12, 1), DialogType.Main, DialogType.Black, DialogEntity.get_id(12, 1)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(12, 2), DialogType.Black, DialogType.Main, DialogEntity.get_id(12, 2)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(12, 3), DialogType.Main, DialogType.Black, DialogEntity.get_id(12, 3)));
                dialog.SetDialogs(deList);
                dialog.SetMissionIcon("task_icon_012");
                dialog.SetBtnAction(() =>
                {
                    task.in_action = false;

                    dialog.CloseDialog();
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);
                });
                dialog.ShowDialog();
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);

                CatsMoveController.GetController().SetDestination(Cats.Main, "Point 31");
                CatsMoveController.GetController().SetDestination(Cats.Black, "Point 58");

                TimerController.GetController().task12_timer.SetActive(false);
                MainLocationOjects.instance.obstruction_toilet_farm.SetActive(false);

                task.in_action = true;
            };

            task.DoneInitAction = () =>
            {
                MainLocationOjects.instance.obstruction_toilet.SetActive(false);
                MainLocationOjects.instance.obstruction_toilet_farm.SetActive(false);
            };

            task.TickAction = () =>
            {
                time_msg_parametr_values[1] = task.time_wait;
                MessageBus.Instance.SendMessage(timer_msg);
            };

            TaskAction tasc_action_1 = new TaskAction();

            tasc_action_1.action = () =>
            {
                time_msg_parametr_values[1] = task.time_wait;
                MessageBus.Instance.SendMessage(timer_msg);

                servered_timer.SetTime("Task12", task.time_wait);

                List <Vector3> points = new List <Vector3>();
                Transform      point  = GameObject.Find("CameraTasksTargets").transform
                                        .Find("TolietObstructions");
                points.Add(point.position);
                CameraMoveController.GetController().SetDestinations(points);

                CatsMoveController.GetController().SetDestination(Cats.Main, "Point 23");
                CatsMoveController.GetController().SetDestination(Cats.Black, "Point 59");

                MainLocationOjects.instance.obstruction_toilet_farm.SetActive(true);
                MainLocationOjects.instance.obstruction_toilet.SetActive(false);

                task.in_action = true;
            };
            tasc_action_1.condition_action = () => { return(true); };


            TaskAction task_action_2 = new TaskAction();

            task_action_2.condition_action = () => { return(task.time_wait <= 0); };
            task_action_2.action           = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };

            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);
            task.TaskActions.Add(task_action_2);

            task.Idle = () =>
            {
                if (task.data.started && !task.data.done && !MainLocationOjects.instance.obstruction_toilet_farm.activeSelf &&
                    task.data.current_action_index > 0)
                {
                    MainLocationOjects.instance.obstruction_toilet_farm.SetActive(true);
                    MainLocationOjects.instance.obstruction_toilet.SetActive(false);
                }
            };

            task.CheckActionConditions = () =>
            {
                if (task.data.current_action_index == 0 && CameraMoveController.GetController().DoesReachDestination())
                {
                    Message msg = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);
                    task.in_action = false;
                }
            };

            task.DoneCondition = () =>
            {
                return(task.data.current_action_index >= task.TaskActions.Count);
            };

            return(task);
        }
Example #13
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            int time_wait      = 0;
            int cur_task_index = 20;

            Task task = new Task(cur_task_index, 1, time_wait, 0, TextManager.getTaskName(21), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icon_019";

            task.BeforeCutScene = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };

            task.CutSceneCondition = () => { return(data.storable_data[18].done == true); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
            };


            task.DoneAction = () =>
            {
            };

            task.DoneInitAction = () =>
            {
            };

            task.CheckActionConditions = () =>
            {
                if (task.data.current_action_index == 0 && CameraMoveController.GetController().DoesReachDestination())
                {
                    task.in_action = false;

                    Message msg = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);
                }
            };

            TaskAction tasc_action_1 = new TaskAction();

            tasc_action_1.action = () =>
            {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
                CameraMoveController.GetController().SetDestinations("CameraTasksTargets", "Garden_1");
                CatsMoveController.GetController().SetDestination(Cats.Main, "Point 70");
                CatsMoveController.GetController().SetDestination(Cats.Black, "Point 77");
                task.in_action = true;
            };
            tasc_action_1.condition_action = () => { return(true); };

            TaskAction tasc_action_2 = new TaskAction();

            tasc_action_2.action = () =>
            {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.DRESS_NORMAL_GARDEN_FLOOR);

                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);

                MessageBus.Instance.SendMessage(new Message(BubbleAPI.OPEN,
                                                            new BubbleCreateParametr(
                                                                CatsMoveController.GetController().main_cat, new List <string>()
                {
                    TextManager.getText("bubble_soft_floor")
                }, 5)));
            };
            tasc_action_2.condition_action = () => { return(true); };


            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);
            task.TaskActions.Add(tasc_action_2);

            task.Idle = () =>
            {
            };

            task.DoneCondition = () =>
            {
                return(task.data.current_action_index >= task.TaskActions.Count);
            };

            return(task);
        }
Example #14
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            int cur_task_index = 9;

            Task task = new Task(cur_task_index, 2, 0, 0, TextManager.getTaskName(10), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icon_008";

            task.BeforeCutScene = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };

            //task.CutSceneCondition = () => { return data.storable_data[8].done == true; };
            task.CutSceneCondition = () => { return(false); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);

                if (!DataController.instance.tasks_storage.content.ContainsKey("catshow_scene"))
                {
                    DataController.instance.tasks_storage.content["catshow_scene"] = false;
                    DataController.instance.tasks_storage.Store();
                }

                if (!DataController.instance.tasks_storage.content.ContainsKey("catshow_first_played"))
                {
                    DataController.instance.tasks_storage.content["catshow_first_played"] = false;
                    DataController.instance.tasks_storage.Store();
                }

                if (!DataController.instance.tasks_storage.content.ContainsKey("mainhome_scene"))
                {
                    DataController.instance.tasks_storage.content["mainhome_scene"] = false;
                    DataController.instance.tasks_storage.Store();
                }

                if (!DataController.instance.tasks_storage.content.ContainsKey("first_shopped"))
                {
                    DataController.instance.tasks_storage.content["first_shopped"] = false;
                    DataController.instance.tasks_storage.Store();
                }
            };

            task.BeforeAction = () => {
            };


            task.DoneAction = () =>
            {
                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 1), DialogType.Black, DialogType.Main, DialogEntity.get_id(10, 1)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 2), DialogType.Main, DialogType.Black, DialogEntity.get_id(10, 2)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 3), DialogType.Main, DialogType.Black, DialogEntity.get_id(10, 3)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 4), DialogType.Main, DialogType.Black, DialogEntity.get_id(10, 4)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 5), DialogType.Black, DialogType.Main, DialogEntity.get_id(10, 5)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 6), DialogType.Main, DialogType.Black, DialogEntity.get_id(10, 6)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);
                });
                dialog.ShowDialog();
                task.in_action = true;
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
            };

            task.DoneInitAction = () =>
            {
            };

            TaskAction tasc_action_1 = new TaskAction();

            tasc_action_1.action = () =>
            {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 7), DialogType.Call_Worker, DialogType.Main, DialogEntity.get_id(10, 7)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 8), DialogType.Call_Worker, DialogType.Main, DialogEntity.get_id(10, 8)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 9), DialogType.Call_Worker, DialogType.Main, DialogEntity.get_id(10, 9)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();
                    task.in_action = false;

                    Message new_msg   = new Message();
                    new_msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    new_msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(new_msg);

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU_CATSHOW);
                    MainScene.ArrowController.Instance.arrow_cat_show.SetActive(true);
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                });
                dialog.ShowDialog();
                task.in_action = true;
            };
            tasc_action_1.condition_action = () => { return(true); };

            TaskAction tasc_action_2 = new TaskAction();

            tasc_action_2.action = () =>
            {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 10), DialogType.Main, DialogType.One, DialogEntity.get_id(10, 10)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 11), DialogType.Main, DialogType.One, DialogEntity.get_id(10, 11)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 12), DialogType.Main, DialogType.One, DialogEntity.get_id(10, 12)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 13), DialogType.Main, DialogType.One, DialogEntity.get_id(10, 13)));

                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();
                    task.in_action = false;

                    Message new_msg   = new Message();
                    new_msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    new_msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(new_msg);

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_CAT_SHOW);
                    MainScene.ArrowController.Instance.arrow_play_show.SetActive(true);
                });
                dialog.ShowDialog();
                task.in_action = true;
            };
            tasc_action_2.condition_action = () => { return((bool)DataController.instance.tasks_storage.content["catshow_scene"]); };

            TaskAction tasc_action_3 = new TaskAction();

            tasc_action_3.action = () =>
            {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 14), DialogType.Main, DialogType.One, DialogEntity.get_id(10, 14)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();
                    task.in_action = false;

                    Message new_msg   = new Message();
                    new_msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    new_msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(new_msg);

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_CAT_SHOW);

                    MainScene.ArrowController.Instance.arrow_shop.SetActive(true);
                    MessageBus.Instance.SendMessage(CatShow.CatShowMessageType.CAT_SHOW_SHOP_BTN);
                });
                dialog.ShowDialog();
                task.in_action = true;
            };
            tasc_action_3.condition_action = () => { return((bool)DataController.instance.tasks_storage.content["catshow_first_played"]); };

            TaskAction tasc_action_4 = new TaskAction();

            tasc_action_4.action = () =>
            {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 15), DialogType.Main, DialogType.One, DialogEntity.get_id(10, 15)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 16), DialogType.Main, DialogType.One, DialogEntity.get_id(10, 16)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(10, 17), DialogType.Main, DialogType.One, DialogEntity.get_id(10, 17)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();
                    task.in_action = false;

                    Message new_msg   = new Message();
                    new_msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    new_msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(new_msg);

                    MessageBus.Instance.SendMessage(CatShow.CatShowMessageType.CAT_SHOW_MAIN_BTN);
                    //MessageBus.Instance.SendMessage(CatShow.CatShowMessageType.CAT_SHOW_SELFIE_BTN);
                });
                dialog.ShowDialog();
                task.in_action = true;

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_SHOP);
            };
            tasc_action_4.condition_action = () => { return((bool)DataController.instance.tasks_storage.content["first_shopped"]); };

            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);
            task.TaskActions.Add(tasc_action_2);
            task.TaskActions.Add(tasc_action_3);
            task.TaskActions.Add(tasc_action_4);

            task.Idle = () =>
            {
            };

            task.DoneCondition = () =>
            {
                return((bool)DataController.instance.tasks_storage.content["mainhome_scene"]);;
            };

            return(task);
        }
Example #15
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            Task task = new Task(0, 1, 0, 0, TextManager.getTaskName(1), true, false);

            task.data = data.storable_data[0];

            task.icon_name = "task_icon_001";

            //Initiate remove trash action, and subscribe
            var subs = new MessageSubscriber();

            subs.MessageTypes = new string[1] {
                Messages.REMOVE_TRASH
            };
            subs.action = (msg) => {
                MainLocationOjects.instance.trash.GetComponent <Animator>().SetBool("end", true);
                MainLocationOjects.instance.trash.transform.Find("trash_001").GetComponent <SpriteRenderer>().enabled = false;
                //MainLocationOjects.instance.trash_scanner.SetActive(true);
                MainLocationOjects.instance.trash_pack.SetActive(true);
            };
            MessageBus.Instance.AddSubscriber(subs);

            task.BeforeCutScene = () =>
            {
                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(TextManager.getDialogsText(1, 1), DialogType.Main, DialogType.One, DialogEntity.get_id(1, 1)));
                deList.Add(new DialogEntity(TextManager.getDialogsText(1, 2), DialogType.Main, DialogType.One, DialogEntity.get_id(1, 2)));
                deList.Add(new DialogEntity(TextManager.getDialogsText(1, 3), DialogType.Main, DialogType.One, DialogEntity.get_id(1, 3)));
                dialog.SetDialogs(deList);

                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);

                    var m       = new Message();
                    m.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                    m.parametrs = new UpdateInt(0);
                    MessageBus.Instance.SendMessage(m);
                });
                dialog.ShowDialog();
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);

                CameraMoveController.GetController().GoCatOnce();
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.ZOOM_CAMERA);
            };

            task.CutSceneCondition = () => { return(true); };

            task.BeforeAction = () => {
                //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);

                if (DataController.instance.catsPurse.Stars == 0)
                {
                    MessageBus.Instance.SendMessage(Main.StarsScreen.API.Messages.HIDE_CLOSE_BTN);

                    MessageBus.Instance.SendMessage(
                        new Message(TutorMaskController.Messages.SHOW_TUTOR_MASK,
                                    new TutorMaskController.TutorMaskParametr(
                                        MainLocationOjects.instance.tasks_btn_footer.transform.position, false, true,
                                        "tasks_btn_footer")));

                    MessageBus.Instance.SendMessage(
                        new Message(TutorMaskController.Messages.SHOW_TUTOR_MASK,
                                    new TutorMaskController.TutorMaskParametr(
                                        MainLocationOjects.instance.taks_1_btn.GetComponent <RectTransform>().anchoredPosition, true, true,
                                        "task_list_task1_btn")));

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU_GAME_BTN);

                    //MessageBus.Instance.SendMessageAfterEvent(MainScene.MainMenuMessageType.OPEN_MINI_GAMES,
                    //    new Message(TutorMaskController.Messages.SHOW_TUTOR_MASK,
                    //        new TutorMaskController.TutorMaskParametr(
                    //            MainLocationOjects.instance.minigames_play_star_btn.GetComponent<RectTransform>().anchoredPosition, true, false,
                    //            "minigames_play_star_btn")));
                }
                else
                {
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);

                    MessageBus.Instance.SendMessage(
                        new Message(TutorMaskController.Messages.SHOW_TUTOR_MASK,
                                    new TutorMaskController.TutorMaskParametr(
                                        MainLocationOjects.instance.taks_1_btn.GetComponent <RectTransform>().anchoredPosition, true, true,
                                        "task_list_task1_btn")));
                }
            };

            task.Idle = () =>
            {
            };

            task.DoneCondition = () =>
            {
                return(data.storable_data[task.index].current_action_index >= task.TaskActions.Count);
            };


            task.CheckActionConditions = () =>
            {
            };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);

                DataController.instance.tasks_storage.content["game_tutor_done"] = false;
                if (!DataController.instance.tasks_storage.content.ContainsKey("opened_pets"))
                {
                    DataController.instance.tasks_storage.content["opened_pets"] = 0;
                }
            };


            task.TaskActions = new List <TaskAction>();
            TaskAction action1 = new TaskAction();

            action1.condition_action = () => { return(true); };
            action1.action           = () =>
            {
                MainLocationOjects.instance.trash.GetComponent <Animator>().SetBool("start", true);

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(2, 1), DialogType.Black, DialogType.Main, DialogEntity.get_id(2, 1)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(2, 2), DialogType.Main, DialogType.Black, DialogEntity.get_id(2, 2)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(2, 3), DialogType.Main, DialogType.Black, DialogEntity.get_id(2, 3)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(2, 4), DialogType.Black, DialogType.Main, DialogEntity.get_id(2, 4)));
                dialog.SetDialogs(deList);
                dialog.SetMessagesByIndex(2, new List <Message> {
                    new Message(Messages.REMOVE_TRASH, null)
                });
                dialog.SetBtnAction(() =>
                {
                    task.in_action = false;

                    dialog.CloseDialog();
                    CameraMoveController.GetController().ClearDestination();

                    Message msg   = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);

                    //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.NEW_TASK_AVALIBLE);
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                });
                dialog.ShowDialog();

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
                //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_TASK_LIST);

                CatsMoveController.GetController().ActiveCat(Cats.Black);
                CatsMoveController.GetController().
                SetDestination(Cats.Black, "Point 4");
                CatsMoveController.GetController().
                SetDestination(Cats.Main, "Point 2");
                CameraMoveController.GetController().GoCat();

                task.in_action = true;
            };
            task.TaskActions.Add(action1);

            task.CheckActionConditions = () =>
            {
                if (task.data.current_action_index == 1)
                {
                    if (DataController.instance.cat_rang.curRang > 0)
                    {
                        Message new_msg = new Message();
                        new_msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                        new_msg.parametrs = new UpdateInt(task.index);
                        MessageBus.Instance.SendMessage(new_msg);

                        task.in_action = false;
                    }
                }
            };


            //TaskAction action2 = new TaskAction();
            //action2.condition_action = () => { return true; };
            //action2.action = () =>
            //{
            //    task.in_action = true;

            //    if (DataController.instance.cat_rang.curRang == 0)
            //    {
            //        MainLocationOjects.instance.trash.SetActive(false);
            //        MainLocationOjects.instance.trash_scanner.SetActive(true);
            //        MainLocationOjects.instance.trash_pack.SetActive(true);

            //        MessageBus.Instance.SendMessage(
            //            new Message(TutorMaskController.Messages.SHOW_TUTOR_MASK,
            //                new TutorMaskController.TutorMaskParametr(
            //                    MainLocationOjects.instance.trash_scanner.transform.position, false, true,
            //                    "task1_trash_scanner")));

            //        MessageBus.Instance.SendMessage(
            //            new Message(TutorMaskController.Messages.SHOW_TUTOR_MASK,
            //                new TutorMaskController.TutorMaskParametr(
            //                    MainLocationOjects.instance.scanning_btn.transform.position, false, true,
            //                    "scanning_btn")));
            //    }
            //};
            //task.TaskActions.Add(action2);

            task.DoneAction = () =>
            {
                MainLocationOjects.instance.trash.SetActive(false);
                MainLocationOjects.instance.trash_pack.SetActive(true);
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU_SCAN_BTN);
            };

            task.DoneInitAction = () =>
            {
                MainLocationOjects.instance.trash.SetActive(false);
                MainLocationOjects.instance.trash_pack.SetActive(true);
            };

            return(task);
        }
Example #16
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            Task task = new Task(2, 1, 0, 0, "3", false, true);

            task.data = data.storable_data[2];

            task.BeforeCutScene = () =>
            {
            };

            task.CutSceneCondition = () => { return(false); };

            task.Init = () =>
            {
                //if (!DataController.instance.tasks_storage.content.ContainsKey("game_tutor_done"))
                //{
                //    DataController.instance.tasks_storage.content["game_tutor_done"] = false;
                //    DataController.instance.tasks_storage.Store();
                //}
                //else if((bool)DataController.instance.tasks_storage.content.ContainsKey("game_tutor_done") == true)
                //{
                //    if (!data.storable_data[task.index].done)
                //    {
                //        GameStatistics.instance.SendStat("start_story_mission", task.index);
                //        data.storable_data[task.index].started = true;
                //    }
                //}
            };

            task.BeforeAction = () => {
                if (!DataController.instance.tasks_storage.content.ContainsKey("game_tutor_done"))
                {
                    DataController.instance.tasks_storage.content["game_tutor_done"] = false;
                    DataController.instance.tasks_storage.Store();
                }
            };


            task.DoneAction = () =>
            {
            };

            task.DoneInitAction = () =>
            {
            };

            TaskAction tasc_action_1 = new TaskAction();

            tasc_action_1.action = () =>
            {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU_GAMES);

                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };
            tasc_action_1.condition_action = () => { return(true); };


            TaskAction tasc_action_2 = new TaskAction();

            tasc_action_2.action = () =>
            {
                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(3, 4), DialogType.Main, DialogType.Black, DialogEntity.get_id(3, 4)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(3, 5), DialogType.Black, DialogType.Main, DialogEntity.get_id(3, 5)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(3, 6), DialogType.Black, DialogType.Main, DialogEntity.get_id(3, 6)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(3, 7), DialogType.Black, DialogType.Main, DialogEntity.get_id(3, 7)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();
                    task.in_action = false;

                    Message msg   = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);

                    DataController.instance.tasks_storage.content["game_tutor_done"] = true;
                    DataController.instance.tasks_storage.Store();

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                    //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);
                });
                dialog.ShowDialog();
                task.in_action = true;
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
            };
            tasc_action_2.condition_action = () => { return((bool)DataController.instance.tasks_storage.content["game_tutor_done"]); };

            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);
            task.TaskActions.Add(tasc_action_2);

            task.Idle = () =>
            {
            };

            task.CheckActionConditions = () => { };

            task.DoneCondition = () =>
            {
                return(data.storable_data[task.index].current_action_index >= task.TaskActions.Count);
            };

            return(task);
        }
Example #17
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            int time_wait      = 0;
            int cur_task_index = 13;

            Task task = new Task(cur_task_index, 2, time_wait, 0, TextManager.getTaskName(14), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icon_012";

            task.BeforeCutScene = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };

            task.CutSceneCondition = () => { return(data.storable_data[11].done == true); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
            };


            task.DoneAction = () =>
            {
            };

            task.DoneInitAction = () =>
            {
                MainLocationOjects.instance.door_garden.SetActive(false);
                MainLocationOjects.instance.door_wc.SetActive(false);
            };

            task.CheckActionConditions = () =>
            {
                if ((task.data.current_action_index == 1 || task.data.current_action_index == 2) &&
                    CatsMoveController.GetController().DoesCatReachDestination(Cats.Jakky))
                {
                    MainLocationOjects.instance.door_wc.SetActive(false);

                    Message msg = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);

                    task.in_action = false;
                }

                else if ((task.data.current_action_index == 3) &&
                         CatsMoveController.GetController().DoesCatReachDestination(Cats.Main))
                {
                    Message msg = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);

                    task.in_action = false;
                }
            };

            TaskAction tasc_action_1 = new TaskAction();

            tasc_action_1.action = () =>
            {
                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(14, 1), DialogType.Djeki, DialogType.Main, DialogEntity.get_id(14, 1)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(14, 2), DialogType.Main, DialogType.Djeki, DialogEntity.get_id(14, 2)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(14, 3), DialogType.Djeki, DialogType.Main, DialogEntity.get_id(14, 3)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();

                    Message msg   = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);

                    task.in_action = false;
                });
                dialog.ShowDialog();

                CatsMoveController.GetController().ActiveCat(Cats.Jakky);
                CatsMoveController.GetController().SetDestination(Cats.Jakky, "Point 55");
                task.in_action = true;


                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
            };
            tasc_action_1.condition_action = () => { return(true); };


            TaskAction tasc_action_2 = new TaskAction();

            tasc_action_2.action = () =>
            {
                CatsMoveController.GetController().SetDestination(Cats.Jakky, "Point 57");
                task.in_action = true;
            };
            tasc_action_2.condition_action = () => { return(true); };

            TaskAction tasc_action_3 = new TaskAction();

            tasc_action_3.action = () =>
            {
                CatsMoveController.GetController().SetDestination(Cats.Jakky, "Point 35");
                task.in_action = true;
            };
            tasc_action_3.condition_action = () => { return(true); };

            TaskAction tasc_action_4 = new TaskAction();

            tasc_action_4.action = () =>
            {
                MainLocationOjects.instance.door_garden.SetActive(false);

                CatsMoveController.GetController().SetDestination(Cats.Black, "Point 61");
                CatsMoveController.GetController().SetDestination(Cats.Main, "Point 45");

                task.in_action = true;
            };
            tasc_action_4.condition_action = () => { return(true); };

            TaskAction tasc_action_5 = new TaskAction();

            tasc_action_5.action = () =>
            {
                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(14, 4), DialogType.Black, DialogType.One, DialogEntity.get_id(14, 4)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();

                    Message msg   = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);
                });
                dialog.ShowDialog();

                CameraMoveController.GetController().SetPosition(
                    CatsMoveController.GetController().GetCatLocation(Cats.Black));

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
            };
            tasc_action_5.condition_action = () => { return(true); };

            TaskAction tasc_action_6 = new TaskAction();

            tasc_action_6.action = () =>
            {
                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(14, 5), DialogType.Main, DialogType.One, DialogEntity.get_id(14, 5)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();

                    Message msg   = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);
                });
                dialog.ShowDialog();

                CameraMoveController.GetController().SetPosition(
                    CatsMoveController.GetController().GetCatLocation(Cats.Main));

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
            };
            tasc_action_6.condition_action = () => { return(true); };

            TaskAction tasc_action_7 = new TaskAction();

            tasc_action_7.action = () =>
            {
                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(14, 6), DialogType.Black, DialogType.Main, DialogEntity.get_id(14, 6)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();

                    Message msg   = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);
                });
                dialog.ShowDialog();

                List <Vector3> points_main2 = new List <Vector3>();
                Transform      point        = GameObject.Find("CameraTasksTargets").transform
                                              .Find("Task14").transform.Find("Destinations");
                for (int i = 0; i < point.childCount; ++i)
                {
                    points_main2.Add(point.GetChild(i).position);
                }
                CameraMoveController.GetController().SetDestinations(points_main2);

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
            };
            tasc_action_7.condition_action = () => { return(true); };

            TaskAction tasc_action_8 = new TaskAction();

            tasc_action_8.action = () =>
            {
                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(14, 7), DialogType.Main, DialogType.Black, DialogEntity.get_id(14, 7)));
                dialog.SetDialogs(deList);
                dialog.SetMissionIcon("task_icon_013");
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();

                    Message msg   = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);

                    task.in_action = false;
                });
                dialog.ShowDialog();

                task.in_action = true;

                //камера на детской

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
            };
            tasc_action_8.condition_action = () => { return(true); };

            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);
            task.TaskActions.Add(tasc_action_2);
            task.TaskActions.Add(tasc_action_3);
            task.TaskActions.Add(tasc_action_4);
            task.TaskActions.Add(tasc_action_5);
            task.TaskActions.Add(tasc_action_6);
            task.TaskActions.Add(tasc_action_7);
            task.TaskActions.Add(tasc_action_8);

            task.Idle = () =>
            {
            };

            task.DoneCondition = () =>
            {
                return(task.data.current_action_index >= task.TaskActions.Count);
            };

            return(task);
        }
Example #18
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            Task task = new Task(5, 0, 0, 0, "3", false, true);

            task.data = data.storable_data[task.index];

            task.BeforeCutScene = () =>
            {
                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(6, 1), DialogType.Black, DialogType.Main, DialogEntity.get_id(6, 1)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(6, 2), DialogType.Black, DialogType.Main, DialogEntity.get_id(6, 2)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();

                    Message msg   = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                    MainScene.ArrowController.Instance.arrow_kitchen_set.SetActive(true);
                    MainScene.ArrowController.Instance.tutor_customize.SetActive(true);
                });
                dialog.ShowDialog();
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_TASK_LIST);
            };

            task.CutSceneCondition = () => {
                return(false);
            };

            task.Init = () =>
            {
                if (!DataController.instance.tasks_storage.content.ContainsKey("custom_location_tutor"))
                {
                    DataController.instance.tasks_storage.content["custom_location_tutor"] = false;
                    DataController.instance.tasks_storage.Store();
                }
                else if ((bool)DataController.instance.tasks_storage.content.ContainsKey("custom_location_tutor") == true)
                {
                    if (!data.storable_data[task.index].done)
                    {
                        GameStatistics.instance.SendStat("start_story_mission", task.index);
                        data.storable_data[task.index].started = true;
                    }
                }
            };

            task.BeforeAction = () => {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU_GARNITUR);

                if (!DataController.instance.tasks_storage.content.ContainsKey("game_tutor_done"))
                {
                    DataController.instance.tasks_storage.content["game_tutor_done"] = false;
                    DataController.instance.tasks_storage.Store();
                }
            };


            task.DoneAction = () =>
            {
                task.in_action = true;

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(6, 3), DialogType.Main, DialogType.Black, DialogEntity.get_id(6, 3)));
                dialog.SetDialogs(deList);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);

                    task.in_action = false;
                });
                dialog.ShowDialog();
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_CUSTOMIZER);
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
                MainScene.ArrowController.Instance.arrow_kitchen_set.SetActive(false);
                MainScene.ArrowController.Instance.tutor_customize.SetActive(false);
            };

            task.DoneInitAction = () =>
            {
            };


            task.TaskActions = new List <TaskAction>();

            task.Idle = () =>
            {
            };


            task.DoneCondition = () =>
            {
                return((bool)DataController.instance.tasks_storage.content["custom_location_tutor"]);
            };

            return(task);
        }
Example #19
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            Task task = new Task(3, 1, 0, 0, TextManager.getTaskName(4), true, false);

            task.data = data.storable_data[3];

            task.icon_name = "task_icon_003";

            var subs = new MessageSubscriber();

            subs.MessageTypes = new string[1] {
                MainScene.MainMenuMessageType.CLOSE_CUSTOMIZER_MISSIONS
            };
            subs.action = (m) =>
            {
                if (task.in_action)
                {
                    task.in_action = false;

                    Message new_msg = new Message();
                    new_msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    new_msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(new_msg);
                }
            };
            MessageBus.Instance.AddSubscriber(subs);

            task.BeforeCutScene = () =>
            {
                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(3, 1), DialogType.Black, DialogType.Main, DialogEntity.get_id(3, 1)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(3, 2), DialogType.Main, DialogType.Black, DialogEntity.get_id(3, 2)));
                dialog.SetDialogs(deList);
                dialog.SetMissionIcon(task.icon_name);
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();

                    Message msg   = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                    //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);
                });
                dialog.ShowDialog();
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_TASK_LIST);
            };

            task.CutSceneCondition = () => { return(data.storable_data[1].done == true); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
            };


            task.DoneAction = () =>
            {
                MessageBus.Instance.SendMessage(new Message(Main.Bubble.BubbleAPI.PUSH_TO_QUEUE,
                                                            new Main.Bubble.BubbleCreateParametr(
                                                                CatsMoveController.GetController().main_cat, new List <string>()
                {
                    TextManager.getText("bubble_task_3_1"),
                    TextManager.getText("bubble_thansk").Replace("%USERNAME%", DataController.instance.catsPurse.Name)
                }, 8)));
                //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);
            };

            task.DoneInitAction = () =>
            {
                // MainLocationOjects.instance.kitchen.SetActive(true);
            };

            TaskAction task_action_1 = new TaskAction();

            task_action_1.condition_action = () => { return(true); };
            task_action_1.action           = () =>
            {
                List <Vector3> points = new List <Vector3>();
                Transform      point  = GameObject.Find("CameraTasksTargets").transform
                                        .Find("Kitchen");

                points.Add(point.position);

                CameraMoveController.GetController().SetDestinations(points);

                task.in_action = true;

                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.OPEN_CUSTOMIZER;
                msg.parametrs = new Yaga.CommonMessageParametr("Floor_Kitchen");
                MessageBus.Instance.SendMessage(msg);

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_FOOTER);
            };


            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(task_action_1);

            task.Idle = () =>
            {
            };

            task.CheckActionConditions = () =>
            {
            };


            task.DoneCondition = () =>
            {
                return(task.data.current_action_index >= task.TaskActions.Count);
            };

            return(task);
        }
Example #20
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            int time_wait      = 0;
            int cur_task_index = 18;

            Task task = new Task(cur_task_index, 2, time_wait, 0, TextManager.getTaskName(19), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icon_017";

            task.BeforeCutScene = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);
            };

            task.CutSceneCondition = () => { return(data.storable_data[16].done == true); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
            };


            task.DoneAction = () =>
            {
            };

            task.DoneInitAction = () =>
            {
                MainLocationOjects.instance.garden2_bran_closed.SetActive(false);
                MainLocationOjects.instance.garden2_bran.SetActive(true);
            };

            task.CheckActionConditions = () =>
            {
                if (task.data.current_action_index == 0 && CatsMoveController.GetController().DoesCatReachDestination(Cats.Main))
                {
                    task.in_action = false;

                    Message msg = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);
                }
            };

            TaskAction tasc_action_1 = new TaskAction();

            tasc_action_1.action = () =>
            {
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
                CatsMoveController.GetController().SetDestination(Cats.Jakky, "Point 46");
                CatsMoveController.GetController().SetDestination(Cats.Main, "Point 48");
                CameraMoveController.GetController().SetDestinations("CameraTasksTargets", "Saray");
                task.in_action = true;
            };
            tasc_action_1.condition_action = () => { return(true); };

            TaskAction tasc_action_2 = new TaskAction();

            tasc_action_2.action = () =>
            {
                task.in_action = true;
                MainLocationOjects.instance.garden2_bran_closed.SetActive(false);
                MainLocationOjects.instance.garden2_bran.SetActiveTrueWithAnimation();

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(19, 1), DialogType.Main, DialogType.One, DialogEntity.get_id(19, 1)));
                dialog.SetDialogs(deList);
                dialog.SetMissionIcon("task_icon_018");
                dialog.SetMissionIcon("task_icon_019");
                dialog.SetMissionIcon("task_icon_021");
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();

                    Message msg   = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);

                    task.in_action = false;
                });
                dialog.ShowDialog();
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
            };
            tasc_action_2.condition_action = () => { return(true); };


            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);
            task.TaskActions.Add(tasc_action_2);

            task.Idle = () =>
            {
            };

            task.DoneCondition = () =>
            {
                return(task.data.current_action_index >= task.TaskActions.Count);
            };

            return(task);
        }
Example #21
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            int cur_task_index = 24;

            Task task = new Task(cur_task_index, 0, 0, 0, TextManager.getTaskName(25), true, false);

            task.data = data.storable_data[task.index];

            task.icon_name = "task_icons_chapter";

            task.BeforeCutScene = () =>
            {
                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(30, 1), DialogType.Black, DialogType.Main, DialogEntity.get_id(30, 1)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(30, 2), DialogType.Main, DialogType.Black, DialogEntity.get_id(30, 2)));
                dialog.SetDialogs(deList);
                dialog.SetMissionIcon("task_icons_chapter");
                dialog.SetBtnAction(() =>
                {
                    dialog.CloseDialog();

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                    //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);

                    CatsMoveController.GetController().ActiveCat(Cats.Gamer1);
                    CatsMoveController.GetController().ActiveCat(Cats.Gamer2);
                    CatsMoveController.GetController().ActiveCat(Cats.Kitchen1);

                    CatsMoveController.GetController().SetDestination(Cats.Gamer1, "Point 19");
                    CatsMoveController.GetController().SetDestination(Cats.Gamer2, "Point 20");
                    CatsMoveController.GetController().SetDestination(Cats.Kitchen1, "Point 12");

                    Message msg   = new Message();
                    msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                    msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(msg);
                });
                dialog.ShowDialog();
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
            };

            task.CutSceneCondition = () => { return(data.storable_data[7].done == true && data.storable_data[8].done == true); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            var subs = new MessageSubscriber();

            subs.MessageTypes = new string[1] {
                "CHAPTER_PRIZE_CLOSE_END"
            };
            subs.action = (m) =>
            {
                task.in_action = false;

                Message new_msg = new Message();
                new_msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                new_msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(new_msg);
            };
            MessageBus.Instance.AddSubscriber(subs);

            //var subs_mask = new MessageSubscriber();
            //subs_mask.MessageTypes = new string[1] { "CHAPTER_END_SHOW_BUSTER_TUTOR" };
            //subs_mask.action = (m) =>
            //{
            //    List<DialogEntity> deList = new List<DialogEntity>();
            //    deList.Add(new DialogEntity(
            //        TextManager.getDialogsText(30, 6), DialogType.Black, DialogType.Main, DialogEntity.get_id(30, 6)));
            //    dialog.SetDialogs(deList);

            //    dialog.SetBtnAction(() =>
            //    {
            //        //                   task.in_action = false;

            //        dialog.CloseDialog();

            //        Message new_msg = new Message();
            //        new_msg.Type = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
            //        new_msg.parametrs = new UpdateInt(task.index);
            //        MessageBus.Instance.SendMessage(new_msg);

            //        if (DataController.instance.tasks_storage.content.ContainsKey("minigame_magnet_tutor") &&
            //           (bool)DataController.instance.tasks_storage.content["minigame_magnet_tutor"] == false)
            //            return;

            //        MessageBus.Instance.SendMessage(new Message(TutorMaskController.Messages.SHOW_TUTOR_MASK,
            //            new TutorMaskController.TutorMaskParametr(
            //                MainLocationOjects.instance.minigames_btn_footer.transform.position, false, true,
            //                "minigames_btn_footer")));

            //        MessageBus.Instance.SendMessage(new Message(TutorMaskController.Messages.SHOW_TUTOR_MASK,
            //            new TutorMaskController.TutorMaskParametr(
            //                MainLocationOjects.instance.minigames_play_star_btn.GetComponent<RectTransform>().anchoredPosition, true, false,
            //                "minigames_play_star_btn")));

            //        DataController.instance.tasks_storage.content["minigame_magnet_tutor"] = true;
            //        DataController.instance.tasks_storage.Store();

            //        MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.TOGGLE_MAIN_MENU_REVIEW_BTN);
            //    });

            //    dialog.ShowDialog();
            //    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
            //};
            //MessageBus.Instance.AddSubscriber(subs_mask);

            task.BeforeAction = () => {
            };


            task.DoneAction = () =>
            {
            };

            task.DoneInitAction = () =>
            {
            };

            task.TickAction = () =>
            {
            };

            TaskAction tasc_action_1 = new TaskAction();

            tasc_action_1.action = () =>
            {
                MessageBus.Instance.SendMessage(Main.Chapter.API.Messages.OPEN_PRIZE_SCREEN);

                task.in_action = true;
            };
            tasc_action_1.condition_action = () => { return(true); };

            TaskAction tasc_action_2 = new TaskAction();

            tasc_action_2.action = () =>
            {
                task.in_action = true;

                List <DialogEntity> deList = new List <DialogEntity>();
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(30, 3), DialogType.Main, DialogType.Black, DialogEntity.get_id(30, 3)));
                deList.Add(new DialogEntity(
                               TextManager.getDialogsText(30, 4), DialogType.Black, DialogType.Main, DialogEntity.get_id(30, 4)));
                //deList.Add(new DialogEntity(
                //    TextManager.getDialogsText(30, 5), DialogType.Main, DialogType.Black));
                //deList.Add(new DialogEntity(
                //    TextManager.getDialogsText(30, 6), DialogType.Black, DialogType.Main));
                dialog.SetDialogs(deList);
                dialog.SetMissionIcon("task_icon_009");
                dialog.SetMissionIcon("task_icon_010");
                dialog.SetBtnAction(() =>
                {
                    task.in_action = false;

                    dialog.CloseDialog();

                    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                    //MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.OPEN_TASK_LIST);

                    Message new_msg   = new Message();
                    new_msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    new_msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(new_msg);

                    DataController.instance.world_state_data.need_first_booster_tutor = true;
                });
                dialog.ShowDialog();
                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_MENU);
            };
            tasc_action_2.condition_action = () => { return(true); };

            TaskAction tasc_action_3 = new TaskAction();

            tasc_action_3.action = () =>
            {
                task.in_action = true;
            };
            tasc_action_3.condition_action = () => { return(true); };

            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(tasc_action_1);
            task.TaskActions.Add(tasc_action_2);
            //task.TaskActions.Add(tasc_action_3);

            task.CheckActionConditions = () =>
            {
                //if(task.data.current_action_index == 2 && DataController.instance.tasks_storage.content.ContainsKey("minigame_magnet_tutor") &&
                //   (bool)DataController.instance.tasks_storage.content["minigame_magnet_tutor"] == false)
                //{
                //    task.in_action = false;

                //    Message new_msg = new Message();
                //    new_msg.Type = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                //    new_msg.parametrs = new UpdateInt(task.index);
                //    MessageBus.Instance.SendMessage(new_msg);
                //}
            };

            task.Idle = () =>
            {
            };

            task.DoneCondition = () =>
            {
                return(task.data.current_action_index >= task.TaskActions.Count);
            };

            return(task);
        }
Example #22
0
        public static Task Init(DataEntity data)
        {
            DialogController dialog = DialogController.GetController();

            Task task = new Task(1, 1, 0, 0, TextManager.getTaskName(2), true, false);

            task.data = data.storable_data[1];

            task.icon_name = "task_icon_002";

            var subs = new MessageSubscriber();

            subs.MessageTypes = new string[1] {
                MainScene.MainMenuMessageType.CLOSE_CUSTOMIZER_MISSIONS
            };
            subs.action = (m) =>
            {
                if (task.in_action)
                {
                    task.in_action = false;

                    Message new_msg = new Message();
                    new_msg.Type      = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    new_msg.parametrs = new UpdateInt(task.index);
                    MessageBus.Instance.SendMessage(new_msg);
                }
            };
            MessageBus.Instance.AddSubscriber(subs);

            task.BeforeCutScene = () =>
            {
                CatsMoveController.GetController().
                SetDestination(Cats.Black, "Point 11");

                CatsMoveController.GetController().
                SetDestination(Cats.Main, "Point 10");
                CameraMoveController.GetController().GoCat();

                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.CUT_SCENE_SHOWED;
                msg.parametrs = new UpdateInt(task.index);
                MessageBus.Instance.SendMessage(msg);


                //List<DialogEntity> deList = new List<DialogEntity>();
                ////deList.Add(new DialogEntity(
                ////    TextManager.getDialogsText(2, 5), DialogType.Black, DialogType.Main, DialogEntity.get_id(2, 5)));
                ////deList.Add(new DialogEntity(
                ////    TextManager.getDialogsText(2, 6), DialogType.Main, DialogType.Black, DialogEntity.get_id(2, 6)));
                ////dialog.SetDialogs(deList);
                //dialog.SetMissionIcon(task.icon_name);
                //dialog.SetBtnAction(() =>
                //{
                //    dialog.CloseDialog();
                //    CameraMoveController.GetController().ClearDestination();



                //    MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.SHOW_MAIN_MENU);
                //});
                //dialog.ShowDialog();
            };

            task.CutSceneCondition = () => { return(data.storable_data[0].done); };

            task.Init = () =>
            {
                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.ADD_NEW_TASK_ITEM;
                msg.parametrs = new Yaga.CommonMessageParametr(task);
                MessageBus.Instance.SendMessage(msg);
            };

            task.BeforeAction = () => {
            };

            task.DoneAction = () =>
            {
                MainLocationOjects.instance.kitchen.SetActiveTrueWithAnimation();

                MessageBus.Instance.SendMessage(new Message(BubbleAPI.OPEN,
                                                            new BubbleCreateParametr(
                                                                CatsMoveController.GetController().main_cat, new List <string>()
                {
                    TextManager.getText("bubble_joy")
                }, 5)));
            };

            task.DoneInitAction = () =>
            {
                MainLocationOjects.instance.kitchen.SetActiveTrueWithAnimation();
            };

            TaskAction action_1 = new TaskAction();

            action_1.condition_action = () => { return(true); };
            action_1.action           = () =>
            {
                task.in_action = true;

                Message msg = new Message();
                msg.Type      = MainScene.MainMenuMessageType.OPEN_CUSTOMIZER;
                msg.parametrs = new Yaga.CommonMessageParametr("Kitchen_set");
                MessageBus.Instance.SendMessage(msg);

                MessageBus.Instance.SendMessage(MainScene.MainMenuMessageType.CLOSE_MAIN_FOOTER);
            };


            task.TaskActions = new List <TaskAction>();
            task.TaskActions.Add(action_1);

            task.DoneCondition = () =>
            {
                return(task.data.current_action_index >= task.TaskActions.Count);
            };

            task.Idle = () => { };

            task.CheckActionConditions = () =>
            {
                if (task.data.current_action_index == 0)
                {
                    //if(CatsMoveController.GetController().DoesCatReachDestination(Cats.Black) &&
                    //CatsMoveController.GetController().DoesCatReachDestination(Cats.Main))
                    //{
                    //    task.in_action = false;

                    //    Message new_msg = new Message();
                    //    new_msg.Type = MainScene.MainMenuMessageType.SOME_ACTION_DONE;
                    //    new_msg.parametrs = new UpdateInt(task.index);
                    //    MessageBus.Instance.SendMessage(new_msg);
                    //}
                }
            };

            return(task);
        }