Beispiel #1
0
        public static BaseContent GetContentObjectV2(object contentOwner)
        {
            BaseContent contentObj = null;

            if (contentOwner is Section sec)
            {
                switch (sec.SectionType)
                {
                case SectionTypeEnum.Image:
                    contentObj = new ImageSectionContent();
                    break;

                case SectionTypeEnum.Text:
                    contentObj = new TextSectionContent();
                    break;

                default:
                    contentObj = new TitleCaptionSectionContent();
                    break;
                }
            }
            else if (contentOwner is ChatNode)
            {
                contentObj = new NodeContent();
            }
            else if (contentOwner is Button)
            {
                contentObj = new ButtonContent();
            }
            return(contentObj);
        }
        /// <summary>
        /// 获取需修改数据
        /// </summary>
        /// <param name="element"></param>
        /// <param name="buttonContent"></param>
        private void FetchEditData(ListBox element, string buttonContent)
        {
            try
            {
                if (ButtonContent.Equals("编辑"))
                {
                    ButtonContent = "完成";
                    ListBoxItems.Clear();

                    foreach (AlarmClockModel model in MainAlarmClockManager.Instance.AlarmClocks)
                    {
                        AddNewEditReminder(element, model);
                    }
                }
                else if (ButtonContent.Equals("完成"))
                {
                    ButtonContent = "编辑";
                    ListBoxItems.Clear();

                    foreach (AlarmClockModel model in MainAlarmClockManager.Instance.AlarmClocks)
                    {
                        AddNewReminder(element, model);
                    }
                }
            }
            catch (Exception e)
            {
                LogWriter.Instance.Error(e);
            }
        }
 public void DragItem(ButtonContent buttonContent)
 {
     draggingItem.DragContent(buttonContent);
     draggingItem.RectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal,
                                                          buttonContent.ButtonSlot.RectTransform.rect.width);
     isDragging = true;
 }
Beispiel #4
0
        private void LoadPhong()
        {
            int soLuongPhong = PhongDAO.GetSoLuongPhongSuDung();

            tablePhong = PhongDAO.LoadPhongSuDung();
            for (int i = 0; i < soLuongPhong; i++)
            {
                ButtonContent btnContent = new ButtonContent()
                {
                    MaPhong   = tablePhong.Rows[i].Field <int>(0),
                    LoaiPhong = tablePhong.Rows[i].Field <string>(1),
                    TinhTrang = tablePhong.Rows[i].Field <string>(2),
                    TrangThai = tablePhong.Rows[i].Field <string>(3)
                };
                Button myBtn = new Button()
                {
                    Name       = "_" + btnContent.MaPhong.ToString(),
                    Content    = BuildButtonContent(btnContent),
                    Background = new SolidColorBrush(GetButtonColor(btnContent.TinhTrang, btnContent.TrangThai)),
                    Foreground = new SolidColorBrush(Colors.White),
                    Height     = 100,
                    Width      = 120,
                };
                RoutedEventHandler a = new RoutedEventHandler(Button_Click);
                myBtn.Click += a;
                wrapPanel.Children.Add(myBtn);
            }
        }
Beispiel #5
0
        public static BaseContent GetContentObject(object contentOwner)
        {
            BaseContent contentObj = null;

            if (contentOwner is TextSection)
            {
                contentObj = new TextSectionContent();
            }
            else if (contentOwner is ImageSection)
            {
                contentObj = new ImageSectionContent();
            }
            else if (contentOwner is AudioSection || contentOwner is VideoSection || contentOwner is EmbeddedHtmlSection || contentOwner is GifSection)
            {
                contentObj = new TitleCaptionSectionContent();
            }
            else if (contentOwner is ChatNode)
            {
                contentObj = new NodeContent();
            }
            else if (contentOwner is Button)
            {
                contentObj = new ButtonContent();
            }
            return(contentObj);
        }
    public void FromDrop(ButtonContent droppedContent)
    {
        if (hasCooldown)
        {
            Image.color = new Color(Image.color.r * 2, Image.color.g * 2, Image.color.b * 2, Image.color.a);
            ButtonSlot.CooldownShade.fillAmount = 0;
            ButtonSlot.TimerText.text           = "";
            hasCooldown = false;
        }

        switch (droppedContent.ContentType)
        {
        case ContentType.Spell:
            itemId        = droppedContent.itemId;
            ContentType   = ContentType.Spell;
            Image.sprite  = droppedContent.Image.sprite;
            Image.enabled = true;
            if (actionBar.playerInterface.world.PlayerUnit.Character.Spells.HasSpell(itemId))
            {
                spell = actionBar.playerInterface.world.PlayerUnit.Character.Spells.GetSpell(itemId);
            }
            else
            {
                spell = null;
            }
            break;

        default:
            break;
        }
    }
    public void Replace(ButtonContent newContent)
    {
        if (hasCooldown)
        {
            Image.color = new Color(Image.color.r * 2, Image.color.g * 2, Image.color.b * 2, Image.color.a);
            ButtonSlot.CooldownShade.fillAmount = 0;
            ButtonSlot.TimerText.text           = "";
            hasCooldown = false;
        }

        int newItemId = itemId;

        itemId            = newContent.itemId;
        newContent.itemId = newItemId;

        ContentType newContentType = ContentType;

        ContentType            = newContent.ContentType;
        newContent.ContentType = newContentType;

        Sprite newSprite = Image.sprite;

        Image.sprite            = newContent.Image.sprite;
        newContent.Image.sprite = newSprite;

        Enable();
    }
        /// <summary>
        /// Initializes a new instance of the <see cref="ButtonContentViewModel"/> class.
        /// </summary>
        /// <param name="source">The button content model.</param>
        /// <param name="resetState">The state used for resetting.</param>
        /// <param name="dialogService">The dialog service.</param>
        public ButtonContentViewModel(ButtonContent source, ButtonContent resetState, IDialogService dialogService)
        {
            _resetState     = resetState;
            _originalSource = source;
            DialogService   = dialogService;

            MapSelf(source, _model);
        }
Beispiel #9
0
 public IncompatibilityDisplayingModButton(Mod mod)
     : base(mod)
 {
     ButtonContent.Add(incompatibleIcon = new IncompatibleIcon
     {
         Anchor   = Anchor.BottomRight,
         Origin   = Anchor.Centre,
         Position = new Vector2(-13),
     });
 }
Beispiel #10
0
        public void HtmlAttribute_SetsTextValue()
        {
            actual     = string.Empty;
            returnHtml = string.Empty;
            ButtonContent target   = new ButtonContent();
            string        expected = target.TextValue = "Juime Button";

            returnHtml = Utility.ControlButtonContentHtmlBuilder <ButtonContent>(target, _startTag);
            actual     = Utility.GetSection(returnHtml, _startTag);
            Assert.AreEqual(expected, actual);
        }
Beispiel #11
0
        public void HtmlAttribute_SetsCompleteContent()
        {
            actual = string.Empty;
            ButtonContent target = new ButtonContent();

            target.TextValue = "Juime Button";
            string expected = "<button>Juime Button</button>";

            actual = Utility.ControlButtonContentHtmlBuilder <ButtonContent>(target, _startTag);
            Assert.AreEqual(expected, actual);
        }
 public void DropItem(ButtonContent buttonContent)
 {
     if (buttonContent.ContentType != ContentType.Empty)
     {
         draggingItem.DropReplaceContent(buttonContent);
         dragReplaced = true;
     }
     else
     {
         draggingItem.DropContent(buttonContent);
         isDragging = false;
     }
 }
    public virtual void Initialize(ActionBar newActionBar)
    {
        actionBar     = newActionBar;
        buttonContent = gameObject.GetComponentInChildren <ButtonContent>();
        RectTransform = GetComponent <RectTransform>();

        CooldownShade = transform.FindChild("Cooldown").GetComponent <Image>();
        TimerText     = transform.FindChild("Timer").GetComponent <Text>();

        if (buttonContent != null)
        {
            buttonContent.Initialize(actionBar, this);
        }
    }
    public void FromDrag(ButtonContent draggedContent)
    {
        switch (draggedContent.ContentType)
        {
        case ContentType.Spell:
            itemId       = draggedContent.itemId;
            ContentType  = ContentType.Spell;
            Image.sprite = draggedContent.Image.sprite;
            break;

        default:
            break;
        }
    }
Beispiel #15
0
        /// <summary>
        /// Buttons the clicked.
        /// </summary>
        /// <param name="param">The param.</param>
        ///
        void ButtonClicked(object param)
        {
            if (ButtonContent.Equals("Start Timer"))
            {
                this.EnableTimer = true;

                this.StartTimer();
                ButtonContent = "Stop Timer";
            }
            else
            {
                this.EnableTimer = false;

                this.StopTimer();
                ButtonContent = "Start Timer";
            }
        }
Beispiel #16
0
 private async void ActivityIndicator_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "IsRunning")
     {
         if (ActivityIndicator.IsRunning)
         {
             ButtonContent.FadeTo(0.0, 500);
             await ButtonContent.TranslateTo(ButtonContent.TranslationX, ButtonContent.TranslationY + 120, 500);
         }
         else
         {
             ButtonContent.TranslationY = 120;
             ButtonContent.FadeTo(1.0, 500);
             await ButtonContent.TranslateTo(ButtonContent.TranslationX, ButtonContent.TranslationY - 120, 500);
         }
     }
 }
Beispiel #17
0
 public void DropReplaceContent(ButtonContent targetButtonContent)
 {
     targetButtonContent.Replace(draggingContent);
 }
Beispiel #18
0
 public void DropContent(ButtonContent targetButtonContent)
 {
     targetButtonContent.FromDrop(draggingContent);
     gameObject.SetActive(false);
 }
Beispiel #19
0
 public void DragContent(ButtonContent buttonContent)
 {
     gameObject.SetActive(true);
     draggingContent.FromDrag(buttonContent);
 }
Beispiel #20
0
 string BuildButtonContent(ButtonContent btnContent)
 {
     return("Phòng " + btnContent.MaPhong + "\n" + btnContent.LoaiPhong +
            "\n" + btnContent.TinhTrang + "\n" + btnContent.TrangThai);
 }
Beispiel #21
0
 protected override Drawable CreateContent() => content = new ButtonContent();