Example #1
0
        void Handle_ActionsPopoverWillShowPopover(object sender, EventArgs e)
        {
            UIAlertView view = null;

            if (!_ActionsPopoverShown)
            {
                view = new UIAlertView("Loading", "Accessing Database...", new UIAlertViewDelegate(), null, new string[] {});
                view.Show();
                NSRunLoop.Current.RunUntil(NSDate.Now.AddSeconds(.1));
                //show waiting dialog
            }

            UIWebView v = new UIWebView(new CGRect(0, 0, 180, 120));

            v.LoadHtmlString(MonsterHtmlCreator.CreateHtml(_Character.Monster, _Character, true), new NSUrl("http://localhost/"));
            _ActionsPopover.AccessoryView = v;

            List <CharacterActionItem> actions = CharacterActions.GetActions(_Character, _CharacterListView.SelectedCharacter);

            if (!_ActionsPopoverShown)
            {
                view.DismissWithClickedButtonIndex(0, false);
                //hide waiting dialog
                _ActionsPopoverShown = true;
            }
            AddActionItems(actions, _ActionsPopover.Items);
        }
Example #2
0
        private Task ShowCombatStatePage(IHttpContext context)
        {
            StringBuilder blocks = new StringBuilder();

            blocks.CreateHtmlHeader("WebStyles", cl: "combatbody");
            blocks.AppendOpenTag("div", cl: "combatpage");

            actionCallback(() =>
            {
                blocks.Append(MonsterHtmlCreator.CreateCombatList(state));
            });

            blocks.AppendTag("div", classname: "divider");
            string texaasdft = blocks.ToString();

            actionCallback(() =>
            {
                blocks.Append(PlayerHtmlCreator.CreatePlayerView(context, state));
            });
            blocks.AppendCloseTag("div");

            blocks.CreateHtmlFooter();

            String text = blocks.ToString();

            context.Response.StatusCode = 200;


            return(context.SendStringAsync(text, "text/html", Encoding.UTF8));
        }
Example #3
0
        private void ShowCharacter(View v, Character c)
        {
            if (c != null)
            {
                WebView wv = v.FindViewById <WebView>(Resource.Id.characterView);

                wv.LoadDataWithBaseURL(null, MonsterHtmlCreator.CreateHtml(c.Monster), "text/html", "utf-8", null);
            }
            _ViewCharacter = c;
        }
Example #4
0
        void SelectCharacter(Character ch)
        {
            if (ch != _SelectedCharacter)
            {
                _SelectedCharacter = ch;

                if (_SelectedCharacter != null)
                {
                    _MonsterView.LoadHtmlString(MonsterHtmlCreator.CreateHtml(_SelectedCharacter.Monster, _SelectedCharacter), new NSUrl("http://localhost/"));
                }
            }
        }
Example #5
0
        private Task ShowCharPage(IHttpContext context, string id)
        {
            if (id.IsEmptyOrNull() || !Guid.TryParse(id, out Guid gid) || !state.TryGetCharacterById(gid, out var ch))
            {
                return(ShowErrorPage(context, 404, "Not found"));
            }

            String text = MonsterHtmlCreator.CreateHtml(ch.Monster, ch, completePage: true, css: "WebStyles");


            context.Response.StatusCode = 200;
            return(context.SendStringAsync(text, "text/html", Encoding.UTF8));
        }
 protected override string ItemHtml(Monster item)
 {
     return(MonsterHtmlCreator.CreateHtml(item));
 }
Example #7
0
        private Task ShowDatabasePage(IHttpContext context, string [] param)
        {
            if (!param.TryGetIndex(0, out var type))
            {
                return(ShowErrorPage(context, 404, "Not found"));
            }

            var  queryData = context.GetRequestQueryData();
            bool hasId     = queryData.TryGetInt("id", out int id);
            bool custom    = queryData.GetBool("custom");

            string text = "";

            if (!hasId && (new string [] { "monster", "spell", "feat", "magicitem" }).Contains(type))
            {
                return(ShowErrorPage(context, 404, "Not found"));
            }


            switch (type)
            {
            case "monster":
                if (!Monster.TryByID(custom, id, out Monster m))
                {
                    return(ShowErrorPage(context, 404, "Not found"));
                }

                text = MonsterHtmlCreator.CreateHtml(monster: m, completePage: true, css: "WebStyles", addDescription: true);
                break;

            case "spell":
                if (!Spell.TryByID(custom, id, out Spell s))
                {
                    return(ShowErrorPage(context, 404, "Not found"));
                }

                text = SpellHtmlCreator.CreateHtml(spell: s, completepage: true, css: "WebStyles");
                break;

            case "feat":
                if (!Feat.TryByID(custom, id, out Feat f))
                {
                    return(ShowErrorPage(context, 404, "Not found"));
                }

                text = FeatHtmlCreator.CreateHtml(feat: f, completepage: true, css: "WebStyles");
                break;

            case "magicitem":
                if (!MagicItem.TryByID(custom, id, out MagicItem mi))
                {
                    return(ShowErrorPage(context, 404, "Not found"));
                }

                text = MagicItemHtmlCreator.CreateHtml(item: mi, completepage: true, css: "WebStyles");
                break;

            default:
                return(ShowErrorPage(context, 404, "Not found"));
            }



            context.Response.StatusCode = 200;
            return(context.SendStringAsync(text, "text/html", Encoding.UTF8));
        }