public void OnViewDestroy(Evt evt)
 {
     if (mainCamera != null)
     {
         mainCamera.gameObject.SetActive(true);
     }
 }
 private void UpdateJsonInfo()
 {
     foreach (ClusterEvent Evt in ClusterEvents)
     {
         Evt.RebuildJsonStringForGui();
     }
 }
Example #3
0
 public void Do(EvtArgs e)
 {
     if (Evt != null)
     {
         Evt.Invoke(this, e);
     }
 }
Example #4
0
 public void OnPlayerConstruct(Evt evt)
 {
     player          = (PlayerView)evt.Source;
     health          = player.HUD.Health;
     health.MaxValue = player.MaxHealth;
     health.Value    = player.Health;
 }
        public void OnTriggerEnter(Evt evt)
        {
            var collider = (Collider)evt.Data;

            if (collider == null || !collider.CompareTag(playerMeshTag))
            {
                return;
            }

            var takeable = (TakeableView)evt.Source;

            if (takeable.TakeSound != null)
            {
                var player =
                    collider.attachedRigidbody.GetComponent <PlayerView>();
                var pitch = UnityEngine.Random.Range(0.95f, 1.05f);
                audioManager.Play(
                    takeable.TakeSound,
                    player.MidPrioAudioSource,
                    playerMidPrioAudioChannel,
                    pitch);
            }

            takeable.Take();
        }
Example #6
0
 // Update is called once per frame
 void Update()
 {
     if (currentEvent != null)
     {
         if (Input.GetAxis("Option1") != 0 && currentEvent.options.Count > 0)
         {
             Choose(currentEvent.options[0]);
             currentEvent = null;
         }
         if (Input.GetAxis("Option2") != 0 && currentEvent.options.Count > 1)
         {
             Choose(currentEvent.options[1]);
             currentEvent = null;
         }
         if (Input.GetAxis("Option3") != 0 && currentEvent.options.Count > 2)
         {
             Choose(currentEvent.options[2]);
             currentEvent = null;
         }
     }
     else
     {
         if (msgTimeout > 0)
         {
             msgTimeout -= Time.deltaTime;
         }
         else
         {
             text.GetComponent <Text>().text = "";
         }
     }
 }
Example #7
0
        public ucFloorButton(int iFloor)
        {
            InitializeComponent();
            FloorText = iFloor.ToString();

            Evt.Instance(FloorText + "ClearButtonUI").Event += ClearButtonUI;
        }
Example #8
0
 public void SetKeyEvt(KeyCode k, Evt evt)
 {
     if (evt == Evt.Up)            //up
     {
         int i = downEvt.FindIndex(n => n.keycode == k);
         if (i != -1)
         {
             downEvt.RemoveAt(i);
         }
         upEvt.Add(new KeyEvt(k, 1));
         Key [(int)k] = false;
     }
     else if (evt == Evt.Down)              //down
     {
         int i = upEvt.FindIndex(n => n.keycode == k);
         if (i != -1)
         {
             upEvt.RemoveAt(i);
         }
         downEvt.Add(new KeyEvt(k, 1));
         Key [(int)k] = true;
     }
     else if (evt == Evt.Press)              //press
     {
         downEvt.Add(new KeyEvt(k, 1));
     }
 }
        public void OnExplosion(Evt evt)
        {
            var explosive     = (ExplosiveView)evt.Source;
            var explosionInfo = (ExplosiveView.ExplosionInfo)evt.Data;
            var smashable     = explosive.GetComponent <SmashableView>();

            if (smashable != null)
            {
                smashable.Smash(
                    explosionInfo.Force,
                    explosive.ExplosionUpwardsModifier,
                    explosionInfo.Position);
            }

            Collider[] hitObjects = explosionInfo.HitObjects;

            for (int i = 0; i < explosionInfo.HitObjectsCount; ++i)
            {
                var hitSmashable = hitObjects[i].attachedRigidbody
                                   .GetComponent <SmashableView>();

                if (hitSmashable != null &&
                    hitSmashable.GetComponent <ExplosiveView>() == null)
                {
                    float smashUpwardsModifier = 0f;
                    hitSmashable.Smash(
                        explosionInfo.Force,
                        smashUpwardsModifier,
                        explosionInfo.Position);
                }
            }
        }
        public void OnTriggerEnter(Evt evt)
        {
            var       collider     = (Collider)evt.Data;
            Rigidbody colliderBody = collider.attachedRigidbody;

            if (collider == null || colliderBody == null)
            {
                return;
            }

            var colliderSmashing = colliderBody.GetComponent <SmashingView>();
            var smashable        = (SmashableView)evt.Source;

            if (colliderSmashing == null ||
                smashable.GetComponent <ExplosiveView>() != null)
            {
                return;
            }

            float smashForce = UnityEngine.Random.Range(
                colliderSmashing.MinSmashForce, colliderSmashing.MaxSmashForce);

            smashable.Smash(
                smashForce,
                colliderSmashing.SmashUpwardsModifier,
                colliderSmashing.transform.position);
        }
        public void OnCollisionEnter(Evt evt)
        {
            var smashable = (SmashableView)evt.Source;

            if (smashable.IsSmashed)
            {
                return;
            }

            var     collision = (Collision)evt.Data;
            Vector3 impulse   = collision.impulse;

            if (impulse == Vector3.zero)
            {
                return;
            }

            float smashForce = impulse.magnitude / Time.fixedDeltaTime;

            if (smashForce < 64f)
            {
                return;
            }

            // DebugUtils.Log("SmashableContoller.OnCollisionEnter());
            var smashUpwardsModifier = 0f;

            smashable.Smash(smashForce, smashUpwardsModifier,
                            collision.contacts[0].point);
        }
 public void OnViewConstruct(Evt evt)
 {
     player = (PlayerView)evt.Source;
     playStopwatch.Reset();
     playStopwatch.Start();
     mainCamera.gameObject.SetActive(false);
 }
Example #13
0
        public void Register(Evt e, LuaFunction func)
        {
            int v = (int)e;

            evt[v]     = 1;
            funcArr[v] = func;
        }
        public void OnHealthChange(Evt evt)
        {
            int oldHealth = (int)evt.Data;

            if (player.Health < oldHealth)
            {
                if (player.Health <= 0 || player.HurtSound == null)
                {
                    return;
                }

                var pitch = UnityEngine.Random.Range(0.95f, 1.05f);
                audioManager.Play(
                    player.HurtSound,
                    player.HighPrioAudioSource,
                    playerHighPrioAudioChannel,
                    pitch);
            }
            else if (player.Health > oldHealth)
            {
                if (player.TreatSound == null)
                {
                    return;
                }

                var pitch = UnityEngine.Random.Range(0.95f, 1.05f);
                audioManager.Play(player.TreatSound, player.MidPrioAudioSource,
                                  playerMidPrioAudioChannel, pitch);
            }
        }
Example #15
0
        public void OnSkillListItemLearnBtnClick(Evt evt)
        {
            var skillId = (int)evt.Data;

            AnalyticsUtils.AddCategorizedEventParam("Id", skillId);
            LogEvent("Skill.Learn");
        }
Example #16
0
        public void OnPreLevelComplete(Evt evt)
        {
            var player = (PlayerView)evt.Data;

            Everyplay.SetMetadata("Score", player.Score);
            Everyplay.SetMetadata("Time", player.TotalLifetime);
            Everyplay.SetMetadata("Level", playerStateStorage.Get().Level + 1);
        }
        public void OnViewConstruct(Evt evt)
        {
            score = (HUDScoreView)evt.Source;
            int level = PlayerStateStorage.Get().Level;

            score.MaxValue =
                LevelSettingsStorage.Get(level).CompletionScore;
        }
Example #18
0
        public void ReceivedEventInfo(Evt eventlevel, Evt evtype, string message)
        {
			if (DriverEvent != null){
				if( evtype <= eventlevel){
					DriverEvent(evtype, message );
				}
			}
        }
Example #19
0
 public void OnPreLevelComplete(Evt evt)
 {
     AnalyticsUtils.AddEventParam(
         "Player.TotalLifetime", (int)player.TotalLifetime);
     AddPlayerActionsPerMinuteRank();
     AddPlayerDeaths();
     LogEvent("Level.Completion");
 }
Example #20
0
        public void DoorControl()
        {
            // UI의 FloorButton 색깔 제거 및 눌린 층 List에서 제거
            Evt.Instance(model.NowFloor + "ClearButtonUI").Invoke();
            model.ReservedFloorList.Remove(model.NowFloor);

            DoorOpenAndDelayCloseThread();
        }
Example #21
0
        public void OnLevelAreaDestroy(Evt evt)
        {
            if (level == null)
            {
                return;
            }

            levelGenerator.NewArea(player, level);
        }
Example #22
0
 public EventHistory(Evt n)
 {
     name                 = n;
     enabledState         = true;
     activeState          = true;
     frame                = 0;
     realtimeSinceStartup = 0f;
     otherData            = null;
 }
        public void OnSmashStreak(Evt evt)
        {
            if (skill == null)
            {
                return;
            }

            skill.Trigger();
        }
Example #24
0
 public EventHistory(Evt n)
 {
     name = n;
     enabledState = true;
     activeState = true;
     frame = 0;
     realtimeSinceStartup = 0f;
     otherData = null;
 }
Example #25
0
        public void OnLevelGenerate(Evt evt)
        {
            var level        = (LevelView)evt.Data;
            var activatables = level.GetComponentsInChildren <ActivatableView>();

            for (int i = 0; i < activatables.Length; ++i)
            {
                activatables[i].IsActive = true;
            }
        }
        public void OnPreShow(Evt evt)
        {
            var showable = (ShowableView)evt.Source;

            if (showable.PreShowSound != null)
            {
                audioManager.Play(showable.PreShowSound, showable.AudioSource,
                                  uiHighPrioAudioChannel);
            }
        }
Example #27
0
    // Use this for initialization
    void Start()
    {
        Evt    currentEvt    = null;
        Option currentOption = null;

        foreach (string l in eventsData.text.Split('\n'))
        {
            string line = l.Trim();
            if (!line.Contains(" "))
            {
                continue;
            }
            string   op   = line.Split(new char[] { ' ' }, 2)[0];
            string   val  = line.Split(new char[] { ' ' }, 2)[1];
            string[] bits = val.Split(new char[] { ' ' });
            switch (op)
            {
            case "type":
                currentEvt      = new Evt();
                currentEvt.name = val;
                events.Add(currentEvt);
                break;

            case "msg":
                currentEvt.message = val;
                break;

            case "special":
                currentEvt.requiredSpecial = val;
                break;

            case "if":
                currentEvt.ifs.Add(Ops(bits));
                break;

            case "option":
                currentOption      = new Option();
                currentOption.text = val;
                currentEvt.options.Add(currentOption);
                break;

            case "outcome":
                currentOption.outcome = Ops(bits);
                break;

            case "outcomeMsg":
                currentOption.message = val;
                break;
            }
        }
        foreach (Evt e in events)
        {
            Debug.Log(e.Desc());
        }
    }
        public void OnSmash(Evt evt)
        {
            var smashed = (SmashedView)evt.Data;

            if (smashed.SmashSound != null)
            {
                var pitch = UnityEngine.Random.Range(0.95f, 1.05f);
                audioManager.Play(smashed.SmashSound, smashed.AudioSource,
                                  effectsAudioChannel, pitch);
            }
        }
        public void OnShot(Evt evt)
        {
            var shooter = (ShootingView)evt.Source;

            if (shooter.ShotSound != null)
            {
                var pitch = Random.Range(0.95f, 1.05f);
                audioManager.Play(shooter.ShotSound, shooter.AudioSource,
                                  effectsAudioChannel, pitch);
            }
        }
Example #30
0
        private void RForm_Load(object sender, EventArgs e)
        {
            lvt.ListViewItemSorter = new DTComparer(false);

            EventLog el  = new EventLog("System");
            Evt      evt = null;

            foreach (EventLogEntry ent in el.Entries)
            {
                if (ent.Source == "EventLog")
                {
                    ListViewItem lvi   = null;
                    bool         ison  = ent.EventID == 6005;
                    bool         isoff = ent.EventID == 6006;

                    if (ison)   // On
                    {
                        lvi          = new ListViewItem("入");
                        lvi.ImageKey = "on";
                    }
                    else if (isoff)   // Off
                    {
                        lvi          = new ListViewItem("切");
                        lvi.ImageKey = "off";
                    }
                    if (lvi != null)
                    {
                        lvi.Tag = ent.TimeGenerated;
                        lvi.SubItems.Add(ent.TimeGenerated.ToString("yyyy年M月d日 H時m分s秒"));
                        lvt.Items.Add(lvi);
                    }

                    if (ison)
                    {
                        if (evt == null)
                        {
                            evt = new Evt();
                        }
                        evt.dtOn  = ent.TimeGenerated;
                        evt.lvion = lvi;
                    }
                    else if (isoff)
                    {
                        if (evt != null)
                        {
                            evt.lvioff = lvi;
                            evt.dtOff  = ent.TimeGenerated;
                            alevt.Add(evt);
                        }
                        evt = null;
                    }
                }
            }
        }
Example #31
0
        private void RunEvtFunc(Evt e, params object[] param)
        {
            LuaFunction func = funcArr[(int)e];

            if (func == null)
            {
                return;
            }

            LuaManager.CallFunc_VX(func, param);
        }
        //------------------------------------------------------------------------------------------ static --
        private static void GenericBinder(IMRBPattern <M, VM> mrb, string methodPropertyName, string eventType)
        {
            var onChangeItems = mrb.jF2("[" + methodPropertyName + "]");

            for (int i = 0; i < onChangeItems.length; i++)
            {
                var    item   = onChangeItems[i];
                string method = J(item).attr(methodPropertyName);
                Evt.Attach_ToElement(eventType, mrb, item, method, null);
            }
        }
Example #33
0
        private void RForm_Load(object sender, EventArgs e) {
            lvt.ListViewItemSorter = new DTComparer(false);

            EventLog el = new EventLog("System");
            Evt evt = null;
            foreach (EventLogEntry ent in el.Entries) {
                if (ent.Source == "EventLog") {
                    ListViewItem lvi = null;
                    bool ison = ent.EventID == 6005;
                    bool isoff = ent.EventID == 6006;

                    if (ison) { // On
                        lvi = new ListViewItem("入");
                        lvi.ImageKey = "on";
                    }
                    else if (isoff) { // Off
                        lvi = new ListViewItem("切");
                        lvi.ImageKey = "off";
                    }
                    if (lvi != null) {
                        lvi.Tag = ent.TimeGenerated;
                        lvi.SubItems.Add(ent.TimeGenerated.ToString("yyyy年M月d日 H時m分s秒"));
                        lvt.Items.Add(lvi);
                    }

                    if (ison) {
                        if (evt == null) {
                            evt = new Evt();
                        }
                        evt.dtOn = ent.TimeGenerated;
                        evt.lvion = lvi;
                    }
                    else if (isoff) {
                        if (evt != null) {
                            evt.lvioff = lvi;
                            evt.dtOff = ent.TimeGenerated;
                            alevt.Add(evt);
                        }
                        evt = null;
                    }
                }
            }
        }
Example #34
0
 public EventHistory(Evt n, bool e, bool a)
     : this(n)
 {
     enabledState = e;
     activeState = a;
 }
Example #35
0
 public ExpectedEvent(Evt n, bool e, bool a)
     : base(n, e, a)
 {
 }
Example #36
0
 public ExpectedEvent(Evt n)
     : base(n)
 {
 }
Example #37
0
 public ExpectedEvent(Evt n, bool e, bool a, int f)
     : base(n, e, a, f)
 {
 }
Example #38
0
 public static string ToString(Evt mask, ArrayList eventHistory)
 {
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     foreach(EventHistory h in eventHistory) {
       if((mask & h.name) != 0)
     sb.Append(h.ToString()).Append("\n");
     }
     return sb.ToString();
 }
Example #39
0
 public EventHistory(Evt n, int f, float r)
     : this(n, f)
 {
     realtimeSinceStartup = r;
 }
Example #40
0
 public ExpectedEvent(Evt n, bool e, bool a, int f, float r)
     : base(n, e, a, f, r)
 {
 }
Example #41
0
 public ExpectedEvent(Evt n, bool e, bool a, int f, float r, string o)
     : base(n, e, a, f, r, o)
 {
 }
Example #42
0
 public EventHistory(Evt n, bool e, bool a, int f)
     : this(n, e, a)
 {
     frame = f;
 }
Example #43
0
 public EventHistory(Evt n, bool e, bool a, int f, float r)
     : this(n, e, a, f)
 {
     realtimeSinceStartup = r;
 }
Example #44
0
 public void AssertEvents(Evt mask, ExpectedEvent[] expected, ArrayList actual)
 {
     AssertEvents(mask, expected, actual, "Event history did not match expected result.  Got:\n" + EventHistory.ToString(mask, actual) + "\n\nExpected:\n" + EventHistory.ToString(expected));
 }
Example #45
0
    public static bool Assert(Evt mask, ExpectedEvent[] expected, ArrayList actual)
    {
        float lastTime = 0f;

        // TODO: Report meaningful and specific errors.
        int i = 0, j = 0, k = 0, upperBounds = 0;
        upperBounds = Mathf.Max(actual.Count, expected.Length);
        for(i = 0; i < upperBounds; i++) {
        //Debug.Log("i=" + i + ", j=" + j + ", k=" + k + ", expected.Length=" + expected.Length + ", actual.Count=" + actual.Count);
          if(k >= actual.Count) return false;
          EventHistory a = actual[k] as EventHistory;
          if(a == null) throw new System.Exception("Got something other than EventHistory!  Got: " + actual[i]);
          if((a.name & mask) != 0) {
        if(j >= expected.Length) return false;
        if(!expected[j].CheckAgainst(lastTime, a)) return false;
        lastTime = a.realtimeSinceStartup;
        j++;
          }
          k++;
        }

        return true;
    }
Example #46
0
 private void AddEvent(Evt name)
 {
     AddEvent(name, null);
 }
Example #47
0
 private void AddEvent(Evt name, string otherData)
 {
     eventHistory.Add(new EventHistory(name, enabled, gameObject.active, Time.frameCount, Time.realtimeSinceStartup, otherData));
 }
Example #48
0
 public EventHistory(Evt n, int f)
     : this(n)
 {
     frame = f;
 }
Example #49
0
 public EventHistory(Evt n, bool e, bool a, int f, float r, string o)
     : this(n, e, a, f, r)
 {
     otherData = o;
 }
Example #50
0
 public ExpectedEvent(Evt n, int f)
     : base(n, f)
 {
 }
Example #51
0
 public void AssertEvents(Evt mask, ExpectedEvent[] expected, ArrayList actual, string msg)
 {
     AssertTrue(ExpectedEvent.Assert(mask, expected, actual), msg);
 }
Example #52
0
		public void setDriverEventsLevel(Evt Value)
		{
			this.commandProcessor.EventLevel = Value;		
		}
Example #53
0
 public ExpectedEvent(Evt n, int f, float r)
     : base(n, f, r)
 {
 }