Exemplo n.º 1
0
 public void OnPointerClick(PointerEventData e)
 {
     if (gameObject.scene.name == "Game" && _item.IsItem)
     {
         var factroy = new DialogFactory();
         var dialog  = factroy.Create().GetComponent <Dialog>();
         dialog.Show(DialogType.AgreeOnly, _item.Name + "を使用しますか?", () =>
         {
             var player = GameObject.FindWithTag("Player").GetComponent <Treasure>();
         });
     }
     else if (gameObject.scene.name == "ItemSelect")
     {
         var selectorOrder = Resources.Load("Datas/Order/SelectorOrder") as SelectorOrder;
         if (selectorOrder.Results.Contains(_item, new ObjectCompare <Object>()))
         {
             _image.color = Color.white;
             selectorOrder.Results.Remove(_item);
         }
         else
         {
             _image.color = Color.gray;
             selectorOrder.Results.Add(_item);
         }
     }
 }
Exemplo n.º 2
0
        public SurveyTests()
        {
            var userProfileAccessor = new Mock <IStatePropertyAccessor <UserProfile> >();
            var userProfile         = new UserProfile();

            userProfileAccessor.Setup(x => x.GetAsync(It.IsAny <ITurnContext>(), It.IsAny <Func <UserProfile> >(), It.IsAny <CancellationToken>())).ReturnsAsync(userProfile);
            var surveyState = new SurveyState();

            _features = new Features {
                CollateResponses = true, RealisticTypingDelay = false
            };
            var botSettings = new BotSettings();

            _feedbackServiceMock  = new Mock <IFeedbackService>();
            _feedbackBotStateMock = new Mock <IFeedbackBotStateRepository>();
            _feedbackBotStateMock.SetupGet(x => x.UserProfile).Returns(userProfileAccessor.Object);

            var dialogFactory = new DialogFactory(new List <IComponentBuilder <ComponentDialog> >
            {
                new FreeTextDialogComponentBuilder(_feedbackBotStateMock.Object, Options.Create(_features), Options.Create(botSettings)),
                new MultipleChoiceDialogComponentBuilder(_feedbackBotStateMock.Object, Options.Create(_features), Options.Create(botSettings), _feedbackServiceMock.Object),
                new SurveyStartDialogComponentBuilder(_feedbackBotStateMock.Object, Options.Create(_features), Options.Create(botSettings)),
                new SurveyEndDialogComponentBuilder(_feedbackBotStateMock.Object, Options.Create(_features), Options.Create(botSettings), _feedbackServiceMock.Object)
            });

            _dialog = dialogFactory.Create <SurveyDialog>(new InMemoryApprenticeFeedbackSurveyV6());
        }
Exemplo n.º 3
0
        public void CreateCitizens(ISector sector, IBotPlayer botPlayer, IEnumerable <MapRegion> citizenRegions)
        {
            var map = sector.Map;

            foreach (var region in citizenRegions)
            {
                // 1 к 9, потому что это наиболее удобное соотношение
                // для размещения неподвижных блокирующих объектов
                // без преграждения выходов.
                var citizenCount = region.Nodes.Count() / 9f;

                var availableNodes = from node in region.Nodes
                                     where !map.Transitions.Keys.Contains(node)
                                     select node;

                var openNodes = new List <IMapNode>(availableNodes);
                for (var i = 0; i < citizenCount; i++)
                {
                    //TODO Объединить этот блок с генератором сундуков, как дубликат
                    // Выбрать из коллекции доступных узлов
                    var rollIndex  = _citizenGeneratorRandomSource.RollNodeIndex(openNodes.Count);
                    var objectNode = MapRegionHelper.FindNonBlockedNode(openNodes[rollIndex], map, openNodes);
                    if (objectNode == null)
                    {
                        // В этом случае будет сгенерировано на одного жителя меньше.
                        // Узел, с которого не удаётся найти подходящий узел, удаляем,
                        // Чтобы больше его не анализировать, т.к. всё равно будет такой же неудачный исход.
                        openNodes.Remove(openNodes[rollIndex]);
                        continue;
                    }

                    openNodes.Remove(objectNode);
                    var traderDropTable = _schemeService.GetScheme <IDropTableScheme>("trader");

                    var rollCitizenType = _citizenGeneratorRandomSource.RollCitizenType();

                    switch (rollCitizenType)
                    {
                    case CitizenType.Unintresting:
                        CreateCitizen(objectNode, botPlayer);
                        break;

                    case CitizenType.Trader:
                        CreateCitizen(traderDropTable, objectNode, botPlayer);
                        break;

                    case CitizenType.QuestGiver:
                        CreateCitizen(DialogFactory.Create(), objectNode, botPlayer);
                        break;

                    default:
                        //TODO Завести тип исключения на генерацию персонажей мирных жителей.
                        throw new System.Exception();
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void Death()
        {
            var factory = new DialogFactory();
            var dialog  = factory.Create().GetComponent <Dialog>();

            dialog.Show(DialogType.AgreeOnly, "力尽きてしまった。\nメニュー画面に戻ります。", () =>
            {
                MultiSceneManagement.MultiSceneManager.LoadScene("StageSelect");
            });
        }
Exemplo n.º 5
0
        public void Open()
        {
            var factory = new DialogFactory();
            var dialog  = factory.Create().GetComponent <Dialog>();

            dialog.Show(DialogType.Switch, "次の階へ移動しますか?", () =>
            {
                var stage = GameObject.Find("Stage").GetComponent <Stage>();
                stage.Next();
            });
        }
Exemplo n.º 6
0
        public void Open()
        {
            var factroy = new DialogFactory();
            var dialog  = factroy.Create().GetComponent <Dialog>();

            dialog.Show(DialogType.Switch, "出口を見つけた。\n探索を終了しますか?", () =>
            {
                var player = GameObject.FindWithTag("Player").GetComponent <Treasure>();
                player.SwapToContainer();
                MultiSceneManager.LoadScene("Menu");
            });
        }
        /// <summary>
        /// POST: api/Messages
        /// Receive a message from a user and reply to it
        /// </summary>
        public async Task <HttpResponseMessage> Post([FromBody] Activity activity)
        {
            if (activity.Type == ActivityTypes.Message)
            {
                var dialog = dialogFactory.Create <RootDialog>();
                await Conversation.SendAsync(activity, () => dialog);
            }
            else
            {
                HandleSystemMessage(activity);
            }
            var response = Request.CreateResponse(HttpStatusCode.OK);

            return(response);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 必须确保dialog的assetbundle已经缓存在字典后调用
        /// </summary>
        /// <param name="dialogName"></param>
        /// <returns></returns>
        private UIWindow CreateDialog(string dialogName)
        {
            if (string.IsNullOrEmpty(dialogName))
            {
                return(null);
            }

            var assetBundleName = DialogAssetBundleMap.GetAssetBundleName(dialogName);
            var prefab          = _resource.GetResource <GameObject>(assetBundleName, dialogName);

            if (!prefab)
            {
                return(null);
            }

            return(_dialogFactory.Create(prefab));
        }
Exemplo n.º 9
0
 public static void Show(string message, Action <bool> onCloseCallback)
 {
     DialogFactory.Create().Show(message, onCloseCallback);
 }