Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WidgetController dc = new WidgetController();

            rptWidgets.DataSource = dc.GetWidgets();
            rptWidgets.DataBind();
        }
        public void Put_Existing_Widget_NotFound()
        {
            var options = new DbContextOptionsBuilder <WidgetContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;

            using (var context = new WidgetContext(options))
            {
                context.Widgets.Add(new Widget {
                    Id = id1, Name = GetRandomString(), Shape = GetRandomString()
                });
                context.Widgets.Add(new Widget {
                    Id = id2, Name = GetRandomString(), Shape = GetRandomString()
                });
                context.Widgets.Add(new Widget {
                    Id = id3, Name = GetRandomString(), Shape = GetRandomString()
                });
                context.SaveChanges();

                var widgetDTO = new WidgetDTO {
                    Id = Guid.NewGuid(), Name = GetRandomString(), NumberOfGears = 42
                };

                var controller   = new WidgetController(context);
                var actionResult = controller.Put(widgetDTO).Result;
                var result       = actionResult as NotFoundResult;

                Assert.IsNotNull(result);
                Assert.AreEqual(404, result.StatusCode);
            }
        }
Пример #3
0
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (m_widgetController == null)
     {
         m_widgetController = WidgetController.GetInstance();
     }
 }
        public void Get_One_Widget_Found()
        {
            var options = new DbContextOptionsBuilder <WidgetContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;

            using (var context = new WidgetContext(options))
            {
                context.Widgets.Add(new Widget {
                    Id = id1, Name = GetRandomString(), Shape = GetRandomString()
                });
                context.Widgets.Add(new Widget {
                    Id = id2, Name = GetRandomString(), Shape = GetRandomString()
                });
                context.Widgets.Add(new Widget {
                    Id = id3, Name = GetRandomString(), Shape = GetRandomString()
                });
                context.SaveChanges();

                var controller   = new WidgetController(context);
                var actionResult = controller.Get(id2).Result;
                var result       = actionResult as OkObjectResult;
                var widget       = result.Value as WidgetDTO;

                Assert.IsNotNull(result);
                Assert.AreEqual(200, result.StatusCode);
                Assert.IsNotNull(widget);
                Assert.AreEqual(id2, widget.Id);
            }
        }
Пример #5
0
 // Start is called before the first frame update
 void Awake()
 {
     myPictureController = GetComponentInChildren <PictureController>();
     myWidgetController  = GetComponentInChildren <WidgetController>();
     myCaptionController = GetComponentInChildren <CaptionController>();
     mySMControllers     = GetComponentsInChildren <SMController>();
     isEnlarged          = false;
 }
 public WidgetControllerTests()
 {
     Kernel.Bind <ISetWidgetAdminViewData>().ToConstant(A.Fake <ISetWidgetAdminViewData>());
     _widgetService    = A.Fake <IWidgetService>();
     _widgetController = new WidgetController(_webpageRepository, _widgetService)
     {
         ReferrerOverride = "http://www.example.com/"
     };
 }
Пример #7
0
        protected void Edit_Click(object sender, EventArgs e)
        {
            Uri              myUri    = new Uri(Request.Url.ToString());
            string           WidgetID = HttpUtility.ParseQueryString(myUri.Query).Get("ID");
            WidgetController dc       = new WidgetController();

            dc.Update(int.Parse(WidgetID), txtWidgetTitle.Text, chkPublished.Checked);
            Response.Redirect("ListWidget.aspx");
        }
Пример #8
0
        protected void Delete_Click(object sender, EventArgs e)
        {
            LinkButton       btn      = (LinkButton)sender;
            int              WidgetID = int.Parse(btn.CommandArgument);
            WidgetController dc       = new WidgetController();

            dc.DeleteWidget(WidgetID);
            rptWidgets.DataSource = dc.GetWidgets();
            rptWidgets.DataBind();
        }
Пример #9
0
        public override void Execute(Duality.GameObject inSource, object inParameter)
        {
            WidgetController controller = Scene.Current.FindComponent <WidgetController>();
            GameObject       grid       = Scene.Current.FindGameObject("SkinnedCommandGrid");

            if (grid != null && controller != null)
            {
                controller.FocusOn(grid.GetComponent <Widget>());
            }
        }
    /// <summary>
    /// コメントの生成
    /// </summary>
    public GameObject CreateComment(Vector3 position, string speakerName, string text, Color color, double lifeTime)
    {
        if (!charaSpeachPrefab)
        {
            MyUtil.ErrorLog("null値の変数です。");
            return(null);
        }



        GameObject charaSpeach = WidgetController.AddPrefab(UIRoot(), charaSpeachPrefab);

        if (!charaSpeach)
        {
            MyUtil.ErrorLog("null値の変数です。");
            return(null);
        }
        charaSpeach.name = "Comment_" + commentNumber++;
        charaSpeach.transform.localPosition = position;



        CharaSpeach comment = charaSpeach.GetComponent <CharaSpeach>();

        if (!comment)
        {
            MyUtil.ErrorLog("null値の変数です。");
            return(null);
        }
        comment.lifeTime = lifeTime;
        comment.InitializeColor(color);
        if (!comment.speakerNameLabel || null == comment.speakerNameLabel.text)
        {
            MyUtil.ErrorLog("null値の変数です。");
            return(null);
        }
        comment.speakerNameLabel.text = speakerName;



        UILabel label = comment.label;

        if (!label)
        {
            MyUtil.ErrorLog("null値の変数です。");
            return(null);
        }
        label.text = text;



        return(charaSpeach);
    }
Пример #11
0
 /// <summary>
 /// Renders a widget.
 /// </summary>
 /// <param name="htmlHelper"></param>
 /// <param name="widget"></param>
 /// <param name="htmlAttributes"></param>
 /// <returns></returns>
 public static MvcHtmlString Widget(this HtmlHelper htmlHelper, IWidgetController widget, object htmlAttributes = null)
 {
     if (widget is WidgetController)
     {
         return(((WidgetController)widget).Render(htmlHelper, htmlAttributes));
     }
     else
     {
         var widgetController = new WidgetController(widget);
         return(widgetController.Render(htmlHelper, htmlAttributes));
     }
 }
    /// <summary>
    /// ダメージ処理
    /// </summary>
    public void Damage()
    {
//CharacterStatusクラスのDamage()が先に呼ばれる為、
//前回のHPを参照した方が良い?
//        if ( !damageEffectPrefab || !characterStatus || 0 >= characterStatus.HP ) return;
        if (!damageEffectPrefab || !characterStatus || 0 >= prevHP)
        {
            return;
        }



//        int HP = characterStatus.HP;
        int HP = prevHP;

//1度のダメージが3以上だと、演出面で不自然になるかも?

        // 体力の炎パーティクル配列のインデックスを算出
        //現在のHPをもとに、有効な範囲で右端の炎パーティクルがある
        //インデックスを求める。
        int idx = (HP / lifeCountPerUnitHPUI_MAX) - 1;

        idx += ((HP % lifeCountPerUnitHPUI_MAX) >= 1) ? 1 : 0;


        // インデックス0番以外用の炎パーティクル設定
        if (1 <= idx)
        {
            fireSplashParticle.startSpeed = FIRE_SPLASH_PARTICLE_START_SPEED_MIN;
            fireSplashParticle.startSize  = FIRE_SPLASH_PARTICLE_START_SIZE_MIN;
        }

        // インデックス0番用の炎パーティクル設定
        else
        {
            fireSplashParticle.startSpeed = FIRE_SPLASH_PARTICLE_START_SPEED_MAX;
            fireSplashParticle.startSize  = FIRE_SPLASH_PARTICLE_START_SIZE_MAX;
        }

        // ダメージエフェクト用のパーティクルを
        // 対象の炎パーティクルの位置にして発生させる
        fireSplashParticle.transform.position = hpParticles[idx].transform.position;
        fireSplashParticle.Play();



        // ダメージエフェクト用のゲームオブジェクト(スプライト)を生成
        WidgetController.AddPrefab(
            GameObject.Find("UI Root"),
            damageEffectPrefab
            );
    }
Пример #13
0
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (m_widgetController == null)
        {
            m_widgetController = WidgetController.GetInstance();
        }

        if (m_enemyManager == null)
        {
            m_enemyManager = EnemyManager.GetInstance();
        }

        animator.ResetTrigger(MOVE_STATE);
    }
Пример #14
0
        public void TestMethod1()
        {
            // Arrange
            var repo       = new TestController <Widget>();
            var controller = new WidgetController(repo);
            var expected   = repo.Find(1);

            // Act
            var actual = controller.GetWidget(1) as OkNegotiatedContentResult <Widget>;

            // Assert
            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Id, actual.Content.Id);
        }
        public void Get_All_Widgets_Not_Found()
        {
            var options = new DbContextOptionsBuilder <WidgetContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;

            using (var context = new WidgetContext(options))
            {
                var controller   = new WidgetController(context);
                var actionResult = controller.Get().Result;
                var result       = actionResult as NotFoundObjectResult;

                Assert.IsNotNull(result);
                Assert.AreEqual(404, result.StatusCode);
            }
        }
Пример #16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         WidgetController dc = new WidgetController();
         //Check if no paratmeter exist, redirect to list page.
         Uri    myUri    = new Uri(Request.Url.ToString());
         string WidgetID = HttpUtility.ParseQueryString(myUri.Query).Get("ID");
         if (WidgetID == null)
         {
             Response.Redirect("/UserControl/Template/Widget/ListWidget.aspx");
         }
         dc.GetWidget(int.Parse(WidgetID));
         txtWidgetTitle.Text  = dc.WidgetTitle;
         chkPublished.Checked = dc.IsPublished;
     }
 }
Пример #17
0
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (m_widgetController == null)
        {
            m_widgetController = WidgetController.GetInstance();
        }

        if (m_enemyManager == null)
        {
            m_enemyManager = EnemyManager.GetInstance();
        }

        if (m_weaponComponent == null)
        {
            m_weaponComponent = animator.GetComponent <WeaponComponent>();
        }
        m_canFire = true;
    }
    /// <summary>
    /// システムメッセージの生成
    /// </summary>
    public GameObject CreateSystemMessage(string text)
    {
        if (!systemMessagePrefab)
        {
            MyUtil.ErrorLog("null値の変数です。");
            return(null);
        }



        GameObject systemMessage = WidgetController.AddPrefab(UIRoot(), systemMessagePrefab);

        if (!systemMessage)
        {
            MyUtil.ErrorLog("null値の変数です。");
            return(null);
        }
        systemMessage.name = "Message_" + messageNumber++;



        SystemMessage message = systemMessage.GetComponent <SystemMessage>();

        if (!message)
        {
            MyUtil.ErrorLog("null値の変数です。");
            return(null);
        }



        UILabel label = message.label;

        if (!label)
        {
            MyUtil.ErrorLog("null値の変数です。");
            return(null);
        }
        label.text = text;



        return(systemMessage);
    }
        public void Delete_Existing_Widget_NotFound()
        {
            var options = new DbContextOptionsBuilder <WidgetContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;

            using var context = new WidgetContext(options);
            var w1 = new Widget {
                Id = id1, Name = GetRandomString(), Shape = GetRandomString()
            };
            var w2 = new Widget {
                Id = id2, Name = GetRandomString(), Shape = GetRandomString()
            };
            var w3 = new Widget {
                Id = id3, Name = GetRandomString(), Shape = GetRandomString()
            };

            context.Widgets.Add(w1);
            context.Widgets.Add(w2);
            context.Widgets.Add(w3);
            context.SaveChanges();

            // workaround for EF Core tracking issue 12459. See:
            // https://github.com/aspnet/EntityFrameworkCore/issues/12459
            context.Entry(w1).State = EntityState.Detached;
            context.Entry(w2).State = EntityState.Detached;
            context.Entry(w3).State = EntityState.Detached;
            context.SaveChanges();

            Guid id = Guid.NewGuid(); // not in database!

            var controller   = new WidgetController(context);
            var actionResult = controller.Delete(id).Result;
            var result       = actionResult as NotFoundResult;

            Assert.IsNotNull(result);
            Assert.AreEqual(404, result.StatusCode);
        }
Пример #20
0
        public static WidgetController Fixture()
        {
            WidgetController controller = new WidgetController(new WidgetRepository(), "", new LoginView());

            return(controller);
        }
Пример #21
0
 public static WidgetController Fixture()
 {
     WidgetController controller = new WidgetController(new WidgetRepository(), "", new LoginView());
     return controller;
 }
 private WidgetController(WidgetController widgetController)
 {
 }