Beispiel #1
0
 public override void Excuse()
 {
     PlaySoundAtom data = AtomData as PlaySoundAtom;
     //Actor attacker = ActorMgr.Instance.GetActor(OwnerStageEntity.Attacker);
     //if (data == null || OwnerStageEntity == null || attacker == null || OwnerEntity == null)
     //{
     //    return;
     //}
     //if (data.TargetType == eTargetType.TargetType_Self)
     //{
     //    SoundEntity sndEntity = SoundEngine.Instance.PlaySound(data.SoundPrefab + ".ogg", eSoundType.eSoundType_Fight, data.FadeInTime, data.FadeOutTime, data.AutoDestroy ? false : true);//sndObj.AddComponent<SoundEntity> ();
     //    sndEntity.FollowTarget = true;
     //    sndEntity.Targeter = attacker.gameObject;
     //    sndEntity.Postion = attacker.Position;
     //    if (!data.AutoDestroy)
     //    {
     //        List<ulong> list;
     //        if (!OwnerEntity.SoundMap.TryGetValue(data.FlagIndex, out list))
     //        {
     //            list = new List<ulong>();
     //            OwnerEntity.SoundMap[data.FlagIndex] = list;
     //        }
     //        list.Add(sndEntity.ID);
     //    }
     //}
     //else
     //{
     //    foreach (ulong id in OwnerStageEntity.Targeters)
     //    {
     //        Actor act = ActorMgr.Instance.GetActor(id);
     //        if (act == null)
     //        {
     //            continue;
     //        }
     //        SoundEntity sndEntity = SoundEngine.Instance.PlaySound(data.SoundPrefab, eSoundType.eSoundType_Fight, data.FadeInTime, data.FadeOutTime, data.AutoDestroy ? false : true);//sndObj.AddComponent<SoundEntity> ();
     //        sndEntity.FollowTarget = true;
     //        sndEntity.Targeter = act.gameObject;
     //        sndEntity.Postion = act.Position;
     //        if (!data.AutoDestroy)
     //        {
     //            List<ulong> list;
     //            if (!OwnerEntity.SoundMap.TryGetValue(data.FlagIndex, out list))
     //            {
     //                list = new List<ulong>();
     //                OwnerEntity.SoundMap[data.FlagIndex] = list;
     //            }
     //            list.Add(sndEntity.ID);
     //        }
     //    }
     //}
 }
        void ShowGridMenu()
        {
            if (showMenu)
            {
                showMenu = false;
                if (selectedAtom == null)
                {
                    GenericMenu.MenuFunction2 Selected = delegate(System.Object obj)
                    {
                        if (obj as String == "paste")
                        {
                            AddSkillAtom(cacheAtom);
                        }
                        else
                        {
                            Type tp = obj as Type;
                            if (tp == null)
                            {
                                return;
                            }
                            MetaAtom atom = Activator.CreateInstance(tp) as MetaAtom;
                            atom.Owner = _curMetaStage != null ? _curMetaStage.Owner : null;
                            if (atom is PlayEffctAtom)
                            {
                                PlayEffctAtom ea = atom as PlayEffctAtom;
                                ea.FlagIndex = atom.Owner != null?atom.Owner.GetFlagIndex() : 0;
                            }
                            else if (atom is PlaySoundAtom)
                            {
                                PlaySoundAtom sa = atom as PlaySoundAtom;
                                sa.FlagIndex = atom.Owner != null?atom.Owner.GetFlagIndex() : 0;
                            }
                            AddSkillAtom(atom);
                        }
                    };

                    GenericMenu menu = new GenericMenu();


                    var scriptInfos = Utility.GetAllScriptsOfTypeCategorized(typeof(MetaAtom));


                    foreach (Utility.ScriptInfo script in scriptInfos)
                    {
                        if (string.IsNullOrEmpty(script.category))
                        {
                            menu.AddItem(new GUIContent(script.name), false, Selected, script.type);
                        }
                    }


                    foreach (Utility.ScriptInfo script in scriptInfos)
                    {
                        if (!string.IsNullOrEmpty(script.category))
                        {
                            menu.AddItem(new GUIContent(script.category + "/" + script.name), false, Selected, script.type);
                        }
                    }
                    menu.AddSeparator("/");
                    menu.AddItem(new GUIContent("粘贴"), false, Selected, "paste");
                    menu.ShowAsContext();
                }
                else
                {
                    GenericMenu.MenuFunction2 Selected = delegate(object selectedType)
                    {
                        if (selectedType.ToString() == "delete")
                        {
                            RemoveSkillAtom(selectedAtom);
                        }
                        else if (selectedType.ToString() == "copy")
                        {
                            CopySkillAtom(selectedAtom);
                        }
                    };
                    GenericMenu menu = new GenericMenu();
                    menu.AddItem(new GUIContent("删除"), false, Selected, "delete");
                    menu.AddItem(new GUIContent("复制"), false, Selected, "copy");
                    menu.ShowAsContext();
                }
                Event.current.Use();
            }
        }