当前位置: 首页>>代码示例>>C#>>正文


C# AC.SetCentre方法代码示例

本文整理汇总了C#中AC.SetCentre方法的典型用法代码示例。如果您正苦于以下问题:C# AC.SetCentre方法的具体用法?C# AC.SetCentre怎么用?C# AC.SetCentre使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AC的用法示例。


在下文中一共展示了AC.SetCentre方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateMenuPosition

        /**
         * <summary>Updates a Menu's position.</summary>
         * <param name = "menu">The Menu to reposition</param>
         * <param name = "invertedMouse">The y-inverted mouse position</param>
         */
        public void UpdateMenuPosition(AC.Menu menu, Vector2 invertedMouse)
        {
            if (menu.IsUnityUI ())
            {
                if (Application.isPlaying)
                {
                    Vector2 screenPosition = Vector2.zero;

                    if (menu.uiPositionType == UIPositionType.Manual)
                    {
                        return;
                    }
                    else if (menu.uiPositionType == UIPositionType.FollowCursor)
                    {
                        screenPosition = new Vector2 (invertedMouse.x, Screen.height + 1f - invertedMouse.y);
                        menu.SetCentre (screenPosition);
                    }
                    else if (menu.uiPositionType == UIPositionType.OnHotspot)
                    {
                        if (!menu.IsFadingOut ())
                        {
                            if (mouseOverInventory)
                            {
                                screenPosition = new Vector2 (activeInventoryBoxCentre.x, Screen.height + 1f - activeInventoryBoxCentre.y);
                                menu.SetCentre (screenPosition);
                            }
                            else if (KickStarter.playerInteraction.GetActiveHotspot ())
                            {
                                if (menu.canvas.renderMode == RenderMode.WorldSpace)
                                {
                                    menu.SetCentre (KickStarter.playerInteraction.GetActiveHotspot ().transform.position);
                                }
                                else
                                {
                                    screenPosition = KickStarter.playerInteraction.GetHotspotScreenCentre ();
                                    screenPosition = new Vector2 (screenPosition.x * Screen.width, (1f - screenPosition.y) * Screen.height);
                                    menu.SetCentre (screenPosition);
                                }
                            }
                        }
                    }
                    else if (menu.uiPositionType == UIPositionType.AboveSpeakingCharacter)
                    {
                        Char speaker = null;
                        if (dupMenus.Contains (menu))
                        {
                            if (menu.speech != null)
                            {
                                speaker = menu.speech.GetSpeakingCharacter ();
                            }
                        }
                        else
                        {
                            speaker = KickStarter.dialog.GetSpeakingCharacter ();
                        }

                        if (speaker != null)
                        {
                            if (menu.canvas.renderMode == RenderMode.WorldSpace)
                            {
                                menu.SetCentre (speaker.transform.position);
                            }
                            else
                            {
                                screenPosition = speaker.GetScreenCentre ();
                                screenPosition = new Vector2 (screenPosition.x * Screen.width, (1f - screenPosition.y) * Screen.height);
                                menu.SetCentre (screenPosition);
                            }
                        }
                    }
                    else if (menu.uiPositionType == UIPositionType.AbovePlayer)
                    {
                        if (KickStarter.player)
                        {
                            if (menu.canvas.renderMode == RenderMode.WorldSpace)
                            {
                                menu.SetCentre (KickStarter.player.transform.position);
                            }
                            else
                            {
                                screenPosition = KickStarter.player.GetScreenCentre ();
                                screenPosition = new Vector2 (screenPosition.x * Screen.width, (1f - screenPosition.y) * Screen.height);
                                menu.SetCentre (screenPosition);
                            }
                        }
                    }

                }

                return;
            }

            if (invertedMouse == Vector2.zero)
            {
                invertedMouse = KickStarter.playerInput.GetInvertedMouse ();
//.........这里部分代码省略.........
开发者ID:Davetheallthing,项目名称:Space-Walk,代码行数:101,代码来源:PlayerMenus.cs


注:本文中的AC.SetCentre方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。