Exemple #1
0
        public void InitEvt(BaseSkillEvent evt, int skillId, float delay, int spid, int group)
        {
            this.spid     = spid;
            this.skillEvt = evt;
            this.delay    = delay;
            this.skillId  = skillId;
            int num = 1;

            group *= 100;
            for (int i = 0; i < evt.childrenEvents.Count; ++i)
            {
                BaseSkillEvent bse = evt.childrenEvents[i];
                if (SKILL_EVENT_TYPE.子弹 == bse.eventType)
                {
                    for (int j = 0; j < bse.times; ++j)
                    {
                        SkillProgress sp = SkillProgressCtrl.Instance.GetSkillProgress(false);
                        spList.Add(sp);
                        sp.InitEvt(bse, skillId, bse.time + bse.interval * j, group * num + spid, group);
                        ++num;
                    }
                }
                else
                {
                    SkillProgress sp = SkillProgressCtrl.Instance.GetSkillProgress(false);
                    sp.InitEvt(bse, skillId, bse.time, group * num + spid, group);
                    ++num;
                    spList.Add(sp);
                }
            }
        }
Exemple #2
0
 private void DeleteEvent()
 {
     GetParentChildrenEventList().Remove(this);
     childrenEvents.Clear();
     parent    = null;
     skillInfo = null;
 }
Exemple #3
0
 private void ChangeLayer(int value)
 {
     layer = layer + value;
     for (int i = 0; i < childrenEvents.Count; ++i)
     {
         BaseSkillEvent be = childrenEvents[i];
         be.ChangeLayer(value);
     }
 }
Exemple #4
0
        public void Read(BinaryReader br)
        {
            id = br.ReadInt32();
            int count = br.ReadInt32();

            for (int i = 0; i < count; ++i)
            {
                BaseSkillEvent bse = SkillUtils.InstSkillEvent(br, this, null, 0, i);
                bse.Deserialize(br);
            }
        }
Exemple #5
0
        public void Deserialize(BinaryReader br)
        {
            DeserializeTYpe(br);
            int count = br.ReadInt32();

            childrenEvents.Clear();
            for (int i = 0; i < count; ++i)
            {
                BaseSkillEvent bse = SkillUtils.InstSkillEvent(br, skillInfo, this, layer + 1, i);
                bse.Deserialize(br);
            }
        }
Exemple #6
0
        public int GetMaxLayer()
        {
            int layer = this.layer;

            if (childrenEvents.Count > 0)
            {
                for (int i = 0; i < childrenEvents.Count; ++i)
                {
                    BaseSkillEvent be = childrenEvents[i];
                    layer = Mathf.Max(layer, be.GetMaxLayer());
                }
            }
            return(layer);
        }
Exemple #7
0
        private void LayerUpEvent()
        {
            if (parent == null)
            {
                return;
            }
            List <BaseSkillEvent> ppChildrenEventList = parent.GetParentChildrenEventList();
            int index = ppChildrenEventList.IndexOf(parent);

            this.parent.childrenEvents.Remove(this);
            ppChildrenEventList.Insert(index + 1, this);
            this.parent = parent.parent;
            ChangeLayer(-1);
        }
Exemple #8
0
 private void RefreshType()
 {
     if (lastType != eventType)
     {
         lastType = eventType;
         int            index = GetParentChildrenEventList().IndexOf(this);
         BaseSkillEvent nbe   = SkillUtils.InstanceEvent(eventType, skillInfo, parent, layer, index);
         for (int i = 0; i < this.childrenEvents.Count; ++i)
         {
             this.childrenEvents[i].parent = nbe;
             nbe.childrenEvents.Add(this.childrenEvents[i]);
         }
         DeleteEvent();
     }
 }
Exemple #9
0
        private void LayerDownEvent()
        {
            if (this.GetMaxLayer() >= MAX_LAYER)
            {
                return;
            }
            List <BaseSkillEvent> parentChildrenEventList = GetParentChildrenEventList();
            int            index = parentChildrenEventList.IndexOf(parent);
            BaseSkillEvent be    = SkillUtils.InstanceEvent(SKILL_EVENT_TYPE.动作, skillInfo, parent, layer, index);

            parentChildrenEventList.Remove(this);
            be.childrenEvents.Add(this);
            this.parent = be;
            ChangeLayer(1);
        }
Exemple #10
0
        public static BaseSkillEvent InstSkillEvent(BinaryReader br, SkillInfo info, BaseSkillEvent parent, int layer, int index)
        {
            SKILL_EVENT_TYPE eventType = (SKILL_EVENT_TYPE)br.ReadInt32();
            BaseSkillEvent   bse       = SkillUtils.InstanceEvent(eventType, info, parent, layer, index);

            bse.time       = br.ReadSingle();
            bse.times      = br.ReadInt32();
            bse.interval   = br.ReadSingle();
            bse.actionTime = br.ReadSingle();
            bse.key        = bse.GetKey();
#if UNITY_EDITOR
            bse.lastType = eventType;
#endif
            return(bse);
        }
Exemple #11
0
        private void CopyEvent()
        {
            MemoryStream ms = new MemoryStream();
            BinaryWriter bw = new BinaryWriter(ms);

            Serialize(bw);
            bw.Close();
            ms.Close();
            byte[] bytes = ms.GetBuffer();
            bw = null;
            ms = null;

            ms = new MemoryStream(bytes);
            BinaryReader          br = new BinaryReader(ms);
            List <BaseSkillEvent> parentChildrenEventList = GetParentChildrenEventList();
            int            index = parentChildrenEventList.IndexOf(this);
            BaseSkillEvent bse   = SkillUtils.InstSkillEvent(br, skillInfo, this.parent, layer, index + 1);

            bse.Deserialize(br);
            br.Close();
            br = null;
        }
Exemple #12
0
        public static BaseSkillEvent InstanceEvent(SKILL_EVENT_TYPE eventType, SkillInfo info, BaseSkillEvent parent, int layer, int index)
        {
            BaseSkillEvent bse = null;

            switch (eventType)
            {
            case SKILL_EVENT_TYPE.动作:
                bse = new SkillEventAction();
                break;

            case SKILL_EVENT_TYPE.子弹:
                bse = new SkillEventBullet();
                break;
            }
            bse.skillInfo = info;
            bse.parent    = parent;
            bse.eventType = eventType;
            bse.layer     = layer;
            bse.GetParentChildrenEventList().Insert(index, bse);
#if UNITY_EDITOR
            bse.lastType = eventType;
#endif
            return(bse);
        }