コード例 #1
0
    public void PressEventEncounter(string info = "")
    {
        GD.Print("PressEventEncounter -info " + info);
        pressEvent = CareerDb.LoadPressEvent(info);

        Session.ChangeMenu(Menu.Menus.PressEvent);
    }
コード例 #2
0
 public void Init(float minX, float minY, float maxX, float maxY)
 {
     pressEvent = Session.session.career.pressEvent;
     InitControls();
     ScaleControls();
     GetTree().GetRoot().Connect("size_changed", this, "ScaleControls");
 }
コード例 #3
0
ファイル: InputDelegate.cs プロジェクト: rockgong/UniMVC
    // Update is called once per frame
    void Update()
    {
        if (inputSystem == null)
        {
            return;
        }

        if (Input.GetMouseButtonDown(0))
        {
            GameMsg    msg = new GameMsg();
            PressEvent arg = new PressEvent();
            arg.pressType = 0;
            msg.arguement = arg;
            inputSystem.Receive(msg);
        }

        if (Input.GetMouseButtonUp(0))
        {
            GameMsg    msg = new GameMsg();
            PressEvent arg = new PressEvent();
            arg.pressType = 1;
            msg.arguement = arg;
            inputSystem.Receive(msg);
        }

        inputSystem.mousePosition = Input.mousePosition;
    }
コード例 #4
0
 public ClickPacket(Point point, MouseButtons buttons, PressEvent pressEvent)
     : base(0x14)
 {
     Point = point;
     Buttons = buttons;
     PressEvent = pressEvent;
 }
コード例 #5
0
 private void StartEvent(PressEvent pressEvent)
 {
     _worldState.Date = pressEvent.Date;
     if (pressEvent.IsTerminating)
     {
         _scenarios.Clear();
     }
 }
コード例 #6
0
 void Start()
 {
     _scheduler    = GameInit.CreateEventScheduler(WorldStateProvider.State);
     _currentEvent = _scheduler.PopNextEvent();
     if (_currentEvent != null)
     {
         _currentEvent.ProcessEvent(Processor);
     }
 }
コード例 #7
0
        public PressEvent PeekNextEvent()
        {
            PressEvent next = GetFirstSatisfied();

            if (next == null)
            {
                return(null);
            }
            next.Date = _worldState.Date;
            return(next);
        }
コード例 #8
0
        public PressEvent PopNextEvent()
        {
            PressEvent next = GetFirstSatisfied();

            if (next == null)
            {
                return(null);
            }
            next.Date = _worldState.Date;
            _events.Remove(next);
            return(next);
        }
コード例 #9
0
        private void PrepareNextEvent()
        {
            if (_eventQueue.Count == 0)
            {
                _nextEvent   = null;
                IsTerminated = true;
                return;
            }
            var pressEventDao = _eventQueue.Dequeue();

            Debug.Assert(!string.IsNullOrEmpty(pressEventDao.Date), "Story events should contain date.");
            _nextEvent = pressEventDao.Process(_processor);
        }
コード例 #10
0
    public override void Receive(GameMsg msg)
    {
        PressEvent arg = msg.arguement as PressEvent;

        if (arg != null)
        {
            InputEvent evt = new InputEvent();
            evt.inputType = arg.pressType;
            GameMsg msg0 = new GameMsg();
            msg0.arguement = evt;
            Send(msg0);
        }
    }
コード例 #11
0
 private void PrepareNextEvent()
 {
     _lastDate = _lastDate.AddDays(Algorithms.RandomPauseBetweenEvents());
     _converter.AssignedDate = _lastDate;
     if (_eventIndexQueue.Count > 0)
     {
         var eventDao = _events[_eventIndexQueue.Dequeue()];
         Debug.Assert(string.IsNullOrEmpty(eventDao.Date));
         _currentEvent = eventDao.Process(_converter);
     }
     else
     {
         _currentEvent = null;
         IsTerminated  = true;
     }
 }
コード例 #12
0
    public void Publish(PressEvent e, Choice choice)
    {
        _event  = e;
        _choice = choice;

        Debug.Log("Start publishing multiple choice event: " + _event.Date + " choice: " + choice.Title);

        gameObject.SetActive(true);

        // Title and desc
        Title.GetComponent <Text>().text       = choice.Title;
        Description.GetComponent <Text>().text = choice.Description;

        // Image
        bool isImage = choice.ImagePath != null;

        ImageFixedARParent.SetActive(isImage);
        ImageDescription.SetActive(isImage);

        if (isImage)
        {
            string path = Path.Combine(Constants.ArticleImagesResourceFolder, choice.ImagePath).Replace('\\', '/');
            Debug.Log("Loading a publishing image from: " + path);
            var texture = Resources.Load <Texture>(path);
            Assert.IsNotNull(texture, "Wrongly specified image in " + name);
            if (texture != null)
            {
                var image = Image.GetComponent <RawImage>();
                image.texture = texture;

                Image.GetComponent <AspectRatioFitter>().aspectRatio = texture.width / (float)texture.height;

                ImageDescription.GetComponent <Text>().text = choice.ImageLabel;
            }
        }

        // Article text
        bool isArticleText = !string.IsNullOrEmpty(choice.ArticleText);

        Text.SetActive(isArticleText);

        if (isArticleText)
        {
            Text.GetComponent <Text>().text = choice.ArticleText;
        }
    }
コード例 #13
0
    private void PlaySound(PressEvent e)
    {
        if (string.IsNullOrEmpty(e.SoundPath))
        {
            return;
        }
        string path        = Path.Combine(Constants.SoundsResFolder, e.SoundPath).Replace('\\', '/');
        var    audioSource = AudioPlayer.GetComponent <AudioSource>();
        var    ac          = Resources.Load(path) as AudioClip;

        Debug.Assert(ac != null, "Wrong sound name.");
        if (ac == null)
        {
            return;
        }
        audioSource.PlayOneShot(ac);
    }
コード例 #14
0
        // Update is called once per frame
        void Update()
        {
            if (buttonApply)
            {
                buttonApply = false;
                for (int i = 0; i < skipEventsCount; i++)
                {
                    _scheduler.PopNextEvent();
                }
                var info  = Attribs.GetAttribByName("Info");
                var panic = Attribs.GetAttribByName("Panic");
                var fun   = Attribs.GetAttribByName("Fun");
                var tom   = Attribs.GetAttribByName("Tom");
                var alice = Attribs.GetAttribByName("Alice");
                var s     = WorldStateProvider.State;
                s.AddToValue(alice, addToAttributeAlice);
                s.AddToValue(panic, addToAttributePanic);
                s.AddToValue(tom, addToAttributeTom);
                s.AddToValue(fun, addToAttributeFun);
                s.AddToValue(info, addToAttributeInfo);
            }
            if (_currentEvent == null)
            {
                return;
            }

            if (_currentEvent.IsFinished)
            {
                _currentEvent = _scheduler.PopNextEvent();

                if (_currentEvent != null)
                {
                    _currentEvent.ProcessEvent(Processor);
                }
                else
                {
                    GetComponent <ScenePicker>().LoadScene();
                }
            }
        }
コード例 #15
0
 bool IsEdit = false;         //是否编辑中
 public InputFieldEx()
 {
     BeginEdit = new PressEvent();
 }
コード例 #16
0
 public KeyboardPacket(Keys key, PressEvent pressEvent) : base(0x15)
 {
     Key        = key;
     PressEvent = pressEvent;
 }
コード例 #17
0
 public ClickPacket(Point point, MouseButtons buttons, PressEvent pressEvent) : base(0x14)
 {
     Point      = point;
     Buttons    = buttons;
     PressEvent = pressEvent;
 }
コード例 #18
0
 public virtual bool StartEvent(PressEvent key, ref int x, ref int y) => false;
コード例 #19
0
 public virtual bool React(ref int x, ref int y, PressEvent press) => false;
コード例 #20
0
 public KeyboardPacket(Keys key, PressEvent pressEvent)
     : base(0x15)
 {
     Key = key;
     PressEvent = pressEvent;
 }
コード例 #21
0
 public void OnPress(Android.Views.Keycode primaryCode)
 {
     PressEvent?.Invoke(primaryCode);
 }