Esempio n. 1
0
        public static void ProcessCancelSkill(ClientConnection client, CancelSkill message)
        {
            var avatar = client.Avatar as MobileAvatar;

            if (avatar == null)
            {
                client.LogMessage("Canceled a skill invocation, but don't have an avatar.");
                return;
            }

            // If already performing invocation, just cancel it
            bool found = false;

            if (avatar.ActivatingSkill != null && avatar.ActivatingSkill.InvokationId == message.InvokationId)
            {
                avatar.ActivatingSkill = null;
                found = true;
            }
            else
            {
                // search for it in queued skill invocations
                // just generate a new queue with the invocation missing
                var newQueue = new Queue <UseSkill>();
                foreach (UseSkill m in avatar.SkillQueue)
                {
                    if (m.InvokationId == message.InvokationId)
                    {
                        // don't add it
                        found = true;
                    }
                    else
                    {
                        newQueue.Enqueue(m);
                    }
                }
                avatar.SkillQueue = newQueue;
            }
            if (found)
            {
                client.LogMessage("Successfully canceled invocation " + message.InvokationId);
            }
            else
            {
                client.LogMessage("Failed to cancel invocation " + message.InvokationId);
            }
        }
Esempio n. 2
0
        private void Cancel(CancelSkill gameEvent)
        {
            SetSelectable(nowActor.attackType.targetType, false);
            uiMgr.DestroyElement("frame");

            foreach (var actor in battleMgr.actorList)
            {
                uiMgr.DestroyElement("cursor_" + actor.GetComponent <Entity>().battleID);
            }

            gameEvent.actingHero.attackSelected = false;
            gameEvent.actingHero.attackReady    = false;
            gameEvent.actingHero.attackType     = null;
            gameEvent.actingHero.charge         = false;

            EventMgr.Instance.RemoveListener <CancelSkill>(Cancel);
            battleMgr.SetState(State.SELECT_SKILL);
        }