Inheritance: MonoBehaviour
Ejemplo n.º 1
0
        public override void initState()
        {
            base.initState();
            ObservableUtil.currentPath.OnChanged += OnPathChanged;
            _currentPath      = ObservableUtil.currentPath.value;
            _controller       = new ScrollController();
            _overwriteUnknown = false;
            _version          = null;
            var url =
                $"{Configuration.Instance.apiHost}/api/documentation/parse_version/v/2018.1";
            var request        = UnityWebRequest.Get(url);
            var asyncOperation = request.SendWebRequest();

            asyncOperation.completed += operation =>
            {
                if (!mounted)
                {
                    return;
                }

                using (WindowProvider.of(context).getScope())
                {
                    var content = DownloadHandlerBuffer.GetContent(request);
                    var model   = Version.FromJson(JsonValue.Parse(content));
                    setState(() => _version = model);
                }
            };
        }
Ejemplo n.º 2
0
 void OnDestroy()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
Ejemplo n.º 3
0
 public ReorderableListView(
     Key key                           = null,
     Widget header                     = null,
     List <Widget> children            = null,
     ReorderCallback onReorder         = null,
     ScrollController scrollController = null,
     Axis scrollDirection              = Axis.vertical,
     EdgeInsets padding                = null,
     bool reverse                      = false
     ) : base(key: key)
 {
     D.assert(onReorder != null);
     D.assert(children != null);
     D.assert(
         children.All((Widget w) => w.key != null),
         () => "All children of this widget must have a key."
         );
     this.header           = header;
     this.children         = children;
     this.scrollController = scrollController;
     this.scrollDirection  = scrollDirection;
     this.padding          = padding;
     this.onReorder        = onReorder;
     this.reverse          = reverse;
 }
Ejemplo n.º 4
0
    private void DisplayNotifications(List <DelayGramNotification> notifications)
    {
        float    xPosition         = 0.0f;
        float    originalYPosition = 2.3f;
        float    yPosition         = originalYPosition;
        DateTime lastDate          = DateTime.MinValue;

        foreach (var notification in notifications)
        {
            var newDate = notification.dateTime.Date;
            if (newDate != lastDate)
            {
                var dateHeader = GenerateDateHeader(newDate, yPosition);
                dateHeader.transform.parent = scrollArea.transform;
                lastDate   = newDate;
                yPosition -= 0.5f;
            }
            var notificationObject = GenerateNotification(notification.text, xPosition, yPosition);
            notificationObjects.Add(notificationObject);
            notificationObject.transform.parent = scrollArea.transform;
            yPosition -= 0.5f;
        }

        scrollController = scrollArea.AddComponent <ScrollController>();
        scrollController.UpdateScrollArea(scrollArea, scrollArea.transform.localPosition.y, -yPosition);
    }
Ejemplo n.º 5
0
    void Start()
    {
        scrollController      = transform.parent.GetComponentInParent <ScrollController>();
        spriteRenderer.sprite = scrollController.currentLocation.GetRandomLocationSprite();

        startX = transform.position.x;
    }
Ejemplo n.º 6
0
 void OnDestroy()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
Ejemplo n.º 7
0
 public override void initState()
 {
     base.initState();
     this.scrollController = new ScrollController(
         initialScrollOffset: (this.widget.selectedDate.Year - this.widget.firstDate.Year) * _itemExtent
         );
 }
 // this function called when powerplant drag is finished.
 public void PowerPlantDragFinished()
 {
     if (MapController.Instance().GetMouseEventChecker())
     {
         MapController.Instance().DragFinished();
     }
     ScrollController.Instance().ScrollDragEventChecker.BuildingEventType = BuildingEventTypes.None;
 }
Ejemplo n.º 9
0
 // This function is called enter event of mouse on map.
 public void MouseOnMap()
 {
     if (ScrollController.Instance().ScrollDragEventChecker.BuildingEventType == BuildingEventTypes.Barrack ||
         ScrollController.Instance().ScrollDragEventChecker.BuildingEventType == BuildingEventTypes.PowerPlant)
     {
         _dragEventFromScrollToMap = true;
     }
 }
Ejemplo n.º 10
0
        internal SmoothScrollMouseProcessor(IWpfTextView _wpfTextView)
        {
            this.wpfTextView = _wpfTextView;
            var pageScroller = new PageScroller(Dispatcher.CurrentDispatcher, wpfTextView);

            verticalController   = new ScrollController(pageScroller, ScrollingDirection.Vertical);
            horizontalController = new ScrollController(pageScroller, ScrollingDirection.Horizental);
        }
Ejemplo n.º 11
0
 public ToTop(
     ScrollController scrollController,
     float?displayThreshold = null,
     Key key = null) : base(key)
 {
     D.assert(_scrollController != null);
     _displayThreshold = displayThreshold;
     _scrollController = scrollController;
 }
Ejemplo n.º 12
0
 void _init()
 {
     this._scrollController = new ScrollController(initialScrollOffset: this.widget.initialOffset);
     this.widget.controller.scrollController = this._scrollController;
     SchedulerBinding.instance.addPostFrameCallback(duration => { this._onAfterBuild(); });
     this._scrollController.addListener(this._handleOffsetCallback);
     this.widget.controller._headerMode = this.topModeLis;
     this.widget.controller._footerMode = this.bottomModeLis;
 }
Ejemplo n.º 13
0
 public MetaFields(
     List <PositionRecord> items,
     ScrollController controller,
     string githubLink)
 {
     _items      = items;
     _controller = controller;
     _githubLink = githubLink;
 }
Ejemplo n.º 14
0
 public Scrollbar(
     Key key      = null,
     Widget child = null,
     ScrollController controller = null,
     bool isAlwaysShown          = false) : base(key: key)
 {
     this.child         = child;
     this.controller    = controller;
     this.isAlwaysShown = isAlwaysShown;
 }
Ejemplo n.º 15
0
    void Start()
    {
        dir = new DirectoryInfo(Application.persistentDataPath);
        info = dir.GetFiles("*.json");
        Message = "アイヌ文様つくったよ! #AinuMonyouDesign";
        URL = "";

        this.Number = Parent.GetComponent<LoadButtonParam>().Number;
        scroll = FindObjectOfType<ScrollController>();
    }
Ejemplo n.º 16
0
        // Find grid cell xIndex and yIndex according to mouse position
        // Mouse position is same for every screen resolution.
        public void FindTheCell()
        {
            if (_dragEventFromScrollToMap)
            {
                float mouseRatioX = Input.mousePosition.x / Screen.width;
                float mouseRatioY = Input.mousePosition.y / Screen.height;

                // 0.5values sets canvas (0,0)point to middle of the screen.
                Vector2 mousePositionRatio = new Vector2(mouseRatioX - 0.5f, mouseRatioY - 0.5f);
                Canvas  tempCanvas         = GameObject.Find("Canvas").GetComponent <Canvas>();

                Vector2 worldMousePosition = new Vector2(mousePositionRatio.x * tempCanvas.GetComponent <RectTransform>().sizeDelta.x, mousePositionRatio.y * tempCanvas.GetComponent <RectTransform>().sizeDelta.y);

                float yIndex = (worldMousePosition.x - Config.TheMostXCoordinate) / Config.GridSize;
                float xIndex = (Config.TheMostYCoordinate - worldMousePosition.y) / Config.GridSize;

                int roundedXIndex = (int)Math.Floor(xIndex);
                int roundedYIndex = (int)Math.Floor(yIndex);

                if (_activeCellPositionX != roundedXIndex || _activeCellPositionY != roundedYIndex)
                {
                    if (_activeCellPositionX != null && _activeCellPositionY != null)
                    {
                        if (ScrollController.Instance().ScrollDragEventChecker.BuildingEventType == BuildingEventTypes.Barrack)
                        {
                            ColorTheBarrackOnMap((int)_activeCellPositionX, (int)_activeCellPositionY, Color.green);
                        }
                        else if (ScrollController.Instance().ScrollDragEventChecker.BuildingEventType == BuildingEventTypes.PowerPlant)
                        {
                            ColorThePowerPlantOnMap((int)_activeCellPositionX, (int)_activeCellPositionY, Color.green);
                        }
                    }

                    _activeCellPositionX = roundedXIndex;
                    _activeCellPositionY = roundedYIndex;

                    if (ScrollController.Instance().ScrollDragEventChecker.BuildingEventType == BuildingEventTypes.Barrack)
                    {
                        CheckCollidedBuildingCells();
                        if (_activeCellPositionX != null && _activeCellPositionY != null)
                        {
                            ColorTheBarrackOnMap((int)_activeCellPositionX, (int)_activeCellPositionY, Color.blue);
                        }
                    }
                    else if (ScrollController.Instance().ScrollDragEventChecker.BuildingEventType == BuildingEventTypes.PowerPlant)
                    {
                        CheckCollidedBuildingCells();
                        if (_activeCellPositionX != null && _activeCellPositionY != null)
                        {
                            ColorThePowerPlantOnMap((int)_activeCellPositionX, (int)_activeCellPositionY, Color.yellow);
                        }
                    }
                }
            }
        }
Ejemplo n.º 17
0
 public _CupertinoAlertContentSection(
     Key key        = null,
     Widget title   = null,
     Widget message = null,
     ScrollController scrollController = null
     ) : base(key: key)
 {
     this.title            = title;
     this.message          = message;
     this.scrollController = scrollController;
 }
Ejemplo n.º 18
0
 public _CupertinoAlertActionSection(
     Key key = null,
     List <Widget> children            = null,
     ScrollController scrollController = null,
     bool hasCancelButton = false
     ) : base(key: key)
 {
     D.assert(children != null);
     this.children         = children;
     this.scrollController = scrollController;
     this.hasCancelButton  = hasCancelButton;
 }
Ejemplo n.º 19
0
        /// <summary>
        /// this function is called when drag is finished on map.
        /// It checks barrack or powerplant dragged to map.
        /// </summary>
        public void DragFinished()
        {
            _dragEventFromScrollToMap = false;

            CheckSoldierInBuildingArea(ScrollController.Instance().ScrollDragEventChecker.BuildingEventType);
            CheckCollidedBuildingOnDragFinish(ScrollController.Instance().ScrollDragEventChecker.BuildingEventType);

            ScrollController.Instance().ScrollDragEventChecker.BuildingEventType = BuildingEventTypes.None;
            _soldierChecker = false;
            PreventCollision();
            _activeCellPositionY = null;
            _activeCellPositionX = null;
        }
Ejemplo n.º 20
0
        public override void initState()
        {
            base.initState();
            StatusBarManager.statusBarStyle(false);
            this._scrollController    = new ScrollController();
            this._contentFocusNodeKey = GlobalKey.key("_contentFocusNodeKey");
            this._nameFocusNodeKey    = GlobalKey.key("_nameFocusNodeKey");
            this._contactFocusNodeKey = GlobalKey.key("_contactFocusNodeKey");

            this._contentFocusNode.addListener(this._contentFocusNodeListener);
            this._nameFocusNode.addListener(this._nameFocusNodeListener);
            this._contactFocusNode.addListener(this._contactFocusNodeListener);
        }
Ejemplo n.º 21
0
        public override void initState()
        {
            base.initState();

            // Set the scroll position to approximately center the initial year.
            int initialYearIndex = widget.selectedDate.Year - widget.firstDate.Year;
            int initialYearRow   = (int)(1.0f * initialYearIndex / material_._yearPickerColumnCount);
            // Move the offset down by 2 rows to approximately center it.
            int   centeredYearRow = initialYearRow - 2;
            float scrollOffset    = _itemCount < minYears ? 0 : centeredYearRow * material_._yearPickerRowHeight;

            scrollController = new ScrollController(initialScrollOffset: scrollOffset);
        }
Ejemplo n.º 22
0
 void _handleLongPressStart(LongPressStartDetails details)
 {
     _currentController = _controller;
     if (!_checkVertical())
     {
         return;
     }
     _pressStartY = details.localPosition.dy;
     _fadeoutTimer?.cancel();
     _fadeoutAnimationController.forward();
     _dragScrollbar(details.localPosition.dy);
     _dragScrollbarPositionY = details.localPosition.dy;
 }
Ejemplo n.º 23
0
 protected void CheckReferences()
 {
     if (objInt == null)
     {
         objInt = this.gameObject.GetComponent <ObjectInteraction>();
     }
     if ((objInt != null) && (ml == null))
     {
         //ml=objInt.getMessageLog ();
         ml = playerUW.playerHud.MessageScroll;
         //mi =ml.gameObject.GetComponent<UIInput>();
     }
 }
Ejemplo n.º 24
0
        internal SmoothScrollProcessor(IWpfTextView _wpfTextView)
        {
            this.wpfTextView = _wpfTextView;
            var pageScroller = new PageScroller(wpfTextView);

            verticalController   = new ScrollController(pageScroller, ScrollingDirection.Vertical);
            horizontalController = new ScrollController(pageScroller, ScrollingDirection.Horizontal);

            wpfTextView.VisualElement.Loaded += (_, __) =>
            {
                var source = PresentationSource.FromVisual(wpfTextView.VisualElement) as HwndSource;
                source?.AddHook(MessageHook);
            };
        }
Ejemplo n.º 25
0
 void _handleLongPressEnd(LongPressEndDetails details)
 {
     if (!_checkVertical())
     {
         return;
     }
     _handleDragScrollEnd(details.velocity.pixelsPerSecond.dy);
     if (details.velocity.pixelsPerSecond.dy.abs() < 10 &&
         (details.localPosition.dy - _pressStartY).abs() > 0)
     {
         //HapticFeedback.mediumImpact();
     }
     _currentController = null;
 }
Ejemplo n.º 26
0
        private void Scroll(int delta, ScrollController controller)
        {
            var scrollingSpeeds = ScrollingSpeeds.Normal;

            if (radioSlow.IsChecked ?? false)
            {
                scrollingSpeeds = ScrollingSpeeds.Slow;
            }
            else if (radioFast.IsChecked ?? false)
            {
                scrollingSpeeds = ScrollingSpeeds.Fast;
            }

            controller.ScrollView(delta, scrollingSpeeds);
        }
Ejemplo n.º 27
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            scrollController           = new ScrollController(this, ScrollingDirection.Vertical);
            textBox.PreviewMouseWheel += textBox_PreviewMouseWheel;

            var fs     = new FileStream(@"..\..\..\scrollController\ScrollController.cs", FileMode.Open, FileAccess.Read, FileShare.None);
            var reader = new StreamReader(fs);
            var text   = reader.ReadToEnd();

            reader.Close();
            fs.Close();

            textBox.Text = text + text + text;
            textBox.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
        }
Ejemplo n.º 28
0
 protected virtual void Start()
 {
     if (playerUW == null)
     {
         playerUW = GameObject.Find("Gronk").GetComponent <UWCharacter>();
     }
     if (ml == null)
     {
         ml = playerUW.playerHud.MessageScroll;
     }
     //if (mi==null)
     //{
     //	mi = playerUW.playerHud.InputControl;
     //}
     CheckReferences();
 }
Ejemplo n.º 29
0
 public _ReorderableListContent(
     Widget header,
     List <Widget> children,
     ScrollController scrollController,
     Axis scrollDirection,
     EdgeInsets padding,
     ReorderCallback onReorder,
     bool?reverse = null
     )
 {
     this.header           = header;
     this.children         = children;
     this.scrollController = scrollController;
     this.scrollDirection  = scrollDirection;
     this.padding          = padding;
     this.onReorder        = onReorder;
     this.reverse          = reverse;
 }
Ejemplo n.º 30
0
    /// <summary>
    /// 当装滚动控制器
    /// </summary>
    protected void InstallScrollController()
    {
        m_ScrollControllers.Clear();

        ScrollRect[] scrollers = GetTransform().gameObject.GetComponentsInChildren <ScrollRect>();
        foreach (ScrollRect scroller in scrollers)
        {
            ScrollController controller = scroller.gameObject.GetComponent <ScrollController>();
            if (!controller)
            {
                controller = scroller.gameObject.AddComponent <ScrollController>();
            }

            m_ScrollControllers.Add(controller);
        }

        OnInputDeviceChanged(InputManager.Instance.CurrentInputDevice);
    }
Ejemplo n.º 31
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            vscrollController          = new ScrollController(this, ScrollingDirection.Vertical);
            hscrollController          = new ScrollController(this, ScrollingDirection.Horizontal);
            textBox.PreviewMouseWheel += textBox_PreviewMouseWheel;
            HwndSource source = PresentationSource.FromVisual(textBox) as HwndSource;

            source?.AddHook(textBox_Hook);

            var fs     = new FileStream(@"..\..\..\scrollController\ScrollController.cs", FileMode.Open, FileAccess.Read, FileShare.None);
            var reader = new StreamReader(fs);
            var text   = reader.ReadToEnd();

            reader.Close();
            fs.Close();

            textBox.Text = text + text + text;
            textBox.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
        }
Ejemplo n.º 32
0
 public CupertinoActionSheet(
     Key key               = null,
     Widget title          = null,
     Widget message        = null,
     List <Widget> actions = null,
     ScrollController messageScrollController = null,
     ScrollController actionScrollController  = null,
     Widget cancelButton = null
     ) : base(key: key)
 {
     D.assert(actions != null || title != null || message != null || cancelButton != null,
              () =>
              "An action sheet must have a non-null value for at least one of the following arguments: actions, title, message, or cancelButton");
     this.title   = title;
     this.message = message;
     this.actions = actions ?? new List <Widget>();
     this.messageScrollController = messageScrollController;
     this.actionScrollController  = actionScrollController;
     this.cancelButton            = cancelButton;
 }
Ejemplo n.º 33
0
 void Awake()
 {
     instance = this;
 }
Ejemplo n.º 34
0
 void Start()
 {
     scroll = FindObjectOfType<ScrollController>();
 }
Ejemplo n.º 35
0
	void Start() {
		parentScroller = GetComponentInParent<ScrollController>();
		UpdateSprites();

	}
Ejemplo n.º 36
0
	void Start() {
		scrollController = transform.parent.GetComponentInParent<ScrollController>();
		spriteRenderer.sprite = scrollController.currentLocation.GetRandomLocationSprite();

		startX = transform.position.x;
	}