Ejemplo n.º 1
0
    public BattleCreature(Creature creature, CharacterContainer character_container, float attack_next_time, GameObject hpBarPrefab, GameObject skillPrefab, bool is_team = true)
    {
        IsTeam    = is_team;
        this.Info = creature.Info;
        SkinName  = creature.SkinName;
        Idx       = creature.Idx;
        Scale     = 1f;

        GradePercent = creature.GradePercent;
        if (Network.BattleStageInfo != null && Network.BattleStageInfo.MapInfo.MapType == "boss" && Network.BattleStageInfo.MapInfo.MapType == "worldboss" && Network.BattleStageInfo.Recommends.Exists(r => r.ID == Info.ID))
        {
            GradePercent *= GameConfig.Get <float>("boss_recommend_grade_percent");
        }

        Stat = new CreatureStat(creature.CalculateBattleStat(GradePercent));
        Debug.LogFormat("{0} : hp:{1}, a:{2}, pd:{3}, md:{4}", Info.ID, Stat.HP, Stat.Stat.GetAttack(), Stat.Stat.PhysicDefense, Stat.Stat.MagicDefense);
        Grade = creature.Grade;
        Level = creature.Level;

        InitCommon(character_container, attack_next_time, hpBarPrefab, skillPrefab);

        foreach (SkillInfo skill_info in Info.Skills)
        {
            if (skill_info.Type != eSkillType.active)
            {
                continue;
            }
            Skills.Add(new BattleSkill(skill_info, this, creature.Skills.Find(s => s.Info.ID == skill_info.ID).Level));
        }
    }
Ejemplo n.º 2
0
 protected virtual void InitializeContainers()
 {
     DisableProceedButton();
     if (containers == null || containers.Count <= 0)
     {
         OnReplacedEvent = null;
         containers      = new List <ITelepadDeliverableContainer>();
         if (IsStarterMinion || CustomGameSettings.Instance.GetCurrentQualitySetting(CustomGameSettingConfigs.CarePackages).id != "Enabled")
         {
             numberOfDuplicantOptions   = 3;
             numberOfCarePackageOptions = 0;
         }
         else
         {
             numberOfCarePackageOptions = ((UnityEngine.Random.Range(0, 101) <= 70) ? 1 : 2);
             numberOfDuplicantOptions   = 4 - numberOfCarePackageOptions;
         }
         for (int i = 0; i < numberOfDuplicantOptions; i++)
         {
             CharacterContainer characterContainer = Util.KInstantiateUI <CharacterContainer>(containerPrefab.gameObject, containerParent, false);
             characterContainer.SetController(this);
             containers.Add(characterContainer);
         }
         for (int j = 0; j < numberOfCarePackageOptions; j++)
         {
             CarePackageContainer carePackageContainer = Util.KInstantiateUI <CarePackageContainer>(carePackageContainerPrefab.gameObject, containerParent, false);
             carePackageContainer.SetController(this);
             containers.Add(carePackageContainer);
             carePackageContainer.gameObject.transform.SetSiblingIndex(UnityEngine.Random.Range(0, carePackageContainer.transform.parent.childCount));
         }
         selectedDeliverables = new List <ITelepadDeliverable>();
     }
 }
Ejemplo n.º 3
0
        public static void Prefix(CharacterContainer __instance)
        {
            if (path == null)
            {
                path     = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Replace("file:\\", "");
                filepath = Path.Combine(path, filename);
            }

            // Only use mod if config file exists
            if (File.Exists(filepath))
            {
                if (config == null)
                {
                    config = new Config(path, filename);
                }
                if (names == null)
                {
                    names = new NameList(config);
                }

                // new List<MinionIdentity>(Components.LiveMinionIdentities.Items); // NOTE: Maybe eventually track other dupe names and limit new name unless all used.
                var stats      = Traverse.Create(__instance).Property("Stats");
                var name       = stats.Field("Name");
                var gender_val = (String)stats.Field("GenderStringKey").GetValue();

                var old_name = name.GetValue();

                name.SetValue(names.Next(gender_val));

                Debug.Log("Name changed from `" + old_name + "` => `" + name.GetValue() + "`");
            }
        }
Ejemplo n.º 4
0
 public static void Save(string path, CharacterContainer characters)
 {
     //called from button for now
     OnBeforeSave();
     SaveCharacters(path, characters);
     ClearCharacterList();
 }
Ejemplo n.º 5
0
        public async Task <CharacterContainer> GetCharacter(int id)
        {
            var request = new HttpRequestMessage(HttpMethod.Get,
                                                 $"https://xivapi.com/character/{id}?data=mimo");
            var response = await _httpClient.SendAsync(request);

            CharacterContainer character = null;

            if (response.IsSuccessStatusCode)
            {
                try
                {
                    character = JsonConvert.DeserializeObject <CharacterContainer>(await response.Content.ReadAsStringAsync(), new JsonSerializerSettings
                    {
                        NullValueHandling = NullValueHandling.Ignore
                    });
                    CacheService.Set(id.ToString(), character, 60);
                }
                catch
                {
                    //log here
                }
            }
            return(character);
        }
Ejemplo n.º 6
0
 void Awake()
 {
     setColor(characterColor);
     loadStats();
     animator            = this.GetComponent <Animator>();
     input               = InputController.getController();
     charContainer       = GameObject.Find("LevelManager").GetComponent <CharacterContainer>();
     reversableContainer = GameObject.Find("LevelManager").GetComponent <ReversableContainer>();
 }
Ejemplo n.º 7
0
    public void initialize()
    {
        if (this.reversableObjects == null)
        {
            reversableObjects        = new List <Reversable>();
            safeReversableTimeStamps = new List <float>();

            this.charContainer    = GameObject.Find("LevelManager").GetComponent <CharacterContainer>();
            this.cameraController = GameObject.Find("Camera").GetComponent <CameraController>();
        }
    }
Ejemplo n.º 8
0
    private static void SaveCharacters(string path, CharacterContainer characters)
    {
        //write chardata to json file
        string json = JsonUtility.ToJson(characters, true);

        StreamWriter sw = File.CreateText(path);

        sw.Close();

        File.WriteAllText(path, json);
    }
Ejemplo n.º 9
0
 public override void OnPressBack()
 {
     foreach (ITelepadDeliverableContainer container in containers)
     {
         CharacterContainer characterContainer = container as CharacterContainer;
         if ((Object)characterContainer != (Object)null)
         {
             characterContainer.ForceStopEditingTitle();
         }
     }
 }
Ejemplo n.º 10
0
 public virtual void OnPressBack()
 {
     foreach (ITelepadDeliverableContainer container in containers)
     {
         CharacterContainer characterContainer = container as CharacterContainer;
         if ((UnityEngine.Object)characterContainer != (UnityEngine.Object)null)
         {
             characterContainer.ForceStopEditingTitle();
         }
     }
     Show(false);
 }
 private void Initialize(Telepad telepad)
 {
     InitializeContainers();
     foreach (ITelepadDeliverableContainer container in containers)
     {
         CharacterContainer characterContainer = container as CharacterContainer;
         if ((Object)characterContainer != (Object)null)
         {
             characterContainer.SetReshufflingState(false);
         }
     }
     this.telepad = telepad;
 }
Ejemplo n.º 12
0
 void Awake()
 {
     if (instance == null)
     {
         //...set this one to be it...
         instance = this;
     }
     //...otherwise...
     else if (instance != this)
     {
         //...destroy this one because it is a duplicate.
         Destroy(gameObject);
     }
 }
Ejemplo n.º 13
0
 protected override void OnSpawn()
 {
     OnDeliverableAdded();
     EnableProceedButton();
     proceedButton.GetComponentInChildren <LocText>().text = UI.IMMIGRANTSCREEN.EMBARK;
     containers.ForEach(delegate(ITelepadDeliverableContainer container)
     {
         CharacterContainer characterContainer = container as CharacterContainer;
         if ((Object)characterContainer != (Object)null)
         {
             characterContainer.DisableSelectButton();
         }
     });
 }
Ejemplo n.º 14
0
    public static void Load(string path)
    {
        //called from button for now

        //populate container list then create characters
        characterContainer = LoadCharacters(path);

        foreach (CharacterData characterData in characterContainer.characterData)
        {
            SaveLoadManager.CreateCharacter(characterData, SaveLoadManager.prefab, FillRoster.trans);
        }

        OnLoaded();
        ClearCharacterList();
    }
Ejemplo n.º 15
0
    void InitCommon(CharacterContainer character_container, float attack_next_time, GameObject hpBarPrefab, GameObject skillPrefab)
    {
        InitContainer(character_container);

        HPBar = (GameObject.Instantiate(hpBarPrefab) as GameObject).GetComponent <CharacterHPBar>();
        HPBar.transform.SetParent(BattleBase.Instance.HPBarCanvas.transform, false);
        HPBar.Init(this, IsTeam == false, Scale);

        SkillName = (GameObject.Instantiate(skillPrefab) as GameObject).GetComponent <CharacterSkill>();
        SkillName.transform.SetParent(BattleBase.Instance.CharacterSkillCanvas.transform, false);
        SkillName.Init(Character.transform, IsTeam);


        Skills = new List <BattleSkill>();
        Buffs  = new List <Buff>();

        Restart(attack_next_time);
    }
Ejemplo n.º 16
0
    public void InitContainer(CharacterContainer character_container)
    {
        if (character_container == Container)
        {
            return;
        }

        if (Container != null)
        {
            Container.Uninit();
        }

        Container = character_container;
        character_container.Init(AssetManager.GetCharacterAsset(Info.ID, SkinName));
        Character.Creature    = this;
        Character.IsPause     = true;
        Character.IgnoreTween = IgnoreTween;

        Character.transform.localScale = Vector3.one * Scale;
    }
Ejemplo n.º 17
0
    CharacterContainer[] cacheIcons(int heroCount)
    {
        //Creates the character cache... not much else to say
        CharacterContainer[] tempcharacterCache = new CharacterContainer[heroCount + 1];
        int i = 0;

        foreach (XmlNode node in charDetails.heroList)
        {
            CharacterContainer temp = new CharacterContainer();
            temp.iconTexture = Resources.Load(node.ChildNodes[1].InnerText) as Texture;
            int.TryParse(node.Attributes["id"].InnerText, out temp.id);
            temp.powerClass       = node.ChildNodes[6].InnerText;
            tempcharacterCache[i] = temp;
            i++;
        }
        CharacterContainer blankTemp = new CharacterContainer();

        blankTemp.id          = -1;
        blankTemp.iconTexture = Resources.Load("noneicon") as Texture;
        tempcharacterCache[tempcharacterCache.Length - 1] = blankTemp;
        return(tempcharacterCache);
    }
Ejemplo n.º 18
0
    TeamContainer[] cacheTeams(int teamCount)
    {
        TeamContainer[] tempTeamCache = new TeamContainer[teamCount];
        int             i             = 0;

        //node is the complete team node with all the character ID's in it as children
        //i increments through the temp cache object
        foreach (XmlNode node in teamList)
        {
            //Temporary Team Container, removes null reference issues
            TeamContainer tempTeamContainer = new TeamContainer();
            tempTeamContainer.teamArray = new CharacterContainer[teamSize];
            //Increments through the XML datas child nodes
            for (int j = 0; j < teamSize; j++)
            {
                foreach (CharacterContainer cont in characterCache)
                {
                    CharacterContainer temp = new CharacterContainer();
                    int nodeid;
                    int.TryParse(node.ChildNodes[j].InnerText, out nodeid);
                    //If the IDs match the container object is populated and put in to the temp team container
                    if (cont.id == nodeid)
                    {
                        temp.iconTexture = cont.iconTexture;
                        temp.id          = cont.id;
                        temp.powerClass  = cont.powerClass;
                        tempTeamContainer.teamArray[j] = temp;
                        break;
                    }
                }
            }
            //the teap team container is pushed to the temp team cache, this will happen even if the ID couldn't be found
            //it will add a blank object as if the characters id is -1
            tempTeamCache[i] = tempTeamContainer;
            i++;
        }
        return(tempTeamCache);
    }
Ejemplo n.º 19
0
    public BattleCreature(MapCreatureInfo map_creature_info, CharacterContainer character_container, float attack_next_time, GameObject hpBarPrefab, GameObject skillPrefab)
    {
        MapStageDifficulty stage_info = Network.BattleStageInfo;

        IsTeam      = false;
        Info        = map_creature_info.CreatureInfo;
        SkinName    = map_creature_info.SkinName;
        MapCreature = map_creature_info;

        Grade        = map_creature_info.Grade;
        Level        = map_creature_info.Level;
        GradePercent = map_creature_info.GradePercent;
        Enchant      = map_creature_info.Enchant;

        if (map_creature_info.UseLeaderSkillType != pe_UseLeaderSkillType.Manual && Info.TeamSkill != null)
        {
            SetLeader(map_creature_info.UseLeaderSkillType, BattleStage.Instance.OnUseEnemyLeaderSkill);
        }

        switch (map_creature_info.CreatureType)
        {
        case eMapCreatureType.Elite:
            Scale = 1.2f;
            break;

        case eMapCreatureType.Boss:
            Scale = 1.4f;

            if (stage_info.MapInfo.MapType == "boss")
            {
                Level        = Boss.CalculateLevel(Level, stage_info);
                Grade        = Boss.CalculateGrade(Level);
                Enchant      = Boss.CalculateEnchant(Level);
                GradePercent = CreatureInfoManager.Instance.Grades[Grade].enchants[Enchant].stat_percent * GameConfig.Get <float>("boss_grade_percent");
            }
            Battle.Instance.m_BossHP.Init(this);

            break;

        case eMapCreatureType.WorldBoss:
            Scale = 2.5f;
            BattleWorldboss.Instance.m_BossHP.Init(this, true);
            IgnoreTween = true;
            TextOffset  = -20f;
//                IsShowText = false;
            break;
        }
        Stat = new CreatureStat(map_creature_info.GetStat(Level, GradePercent, Enchant));

        AutoSkillIndex = map_creature_info.AutoSkillIndex;
        InitCommon(character_container, attack_next_time, hpBarPrefab, skillPrefab);

        if (map_creature_info.CreatureType == eMapCreatureType.WorldBoss)
        {
            HPBar.gameObject.SetActive(false);
        }

        foreach (SkillInfo skill_info in Info.Skills)
        {
            if (skill_info.Type != eSkillType.active)
            {
                continue;
            }
            Skills.Add(new BattleSkill(skill_info, this, map_creature_info.Level));
        }

        if (map_creature_info.PassiveInfos.Count > 0)
        {
            foreach (var passive_info in map_creature_info.PassiveInfos)
            {
                bool first        = true;
                var  battle_skill = new BattleSkill(passive_info.SkillInfo, this, map_creature_info.Level);
                foreach (var action in passive_info.SkillInfo.Actions)
                {
                    ISkillBuff buff = SkillTarget.DoBuff(action, this, this, battle_skill, 0, null);
                    if (first == true && string.IsNullOrEmpty(passive_info.SkillInfo.ActionName) == false)
                    {
                        first = false;
                        var comp = AssetManager.GetCharacterPrefab("PassiveEtc_" + passive_info.SkillInfo.ActionName).GetComponent <CharacterActionBuffComponent>();
//                         comp.data.InitEffect();
                        CharacterActionBuff new_action = comp.data.CreateAction(comp, PlaybackTime, Character, 999f, false, 1f);
                        buff.Action = new_action;
                    }
                }
            }
            var buff_worldboss = Buffs.Find(b => b.ActionInfo.actionType == eActionType.worldboss);
            if (buff_worldboss != null)
            {
                Stat.HP = Stat.MaxHP = buff_worldboss.ActionInfo.value;
            }
            else
            {
                Stat.HP = Stat.MaxHP = Stat.Stat.MaxHP;
            }
            Stat.MP = Stat.Stat.ManaInit;
        }
    }
Ejemplo n.º 20
0
    // Use this for initialization
    void Awake()
    {
        MyCharacters  = new CharacterContainer();
        MyPaths       = new PathsContainer();
        MyDisciplines = new DisciplineContainer();
        MyConcepts    = new ConceptContainer();
        MyClans       = new ClanContainer();
        MyBackgrounds = new BackgroundContainer();
        MyArchetypes  = new ArchetypesContainer();
        MyMeritFlaws  = new MeritFlawContainer();
        MyStats       = new StatContainer();

        CharacterXMLPath  = Application.dataPath + "/XML/Characters2.xml";
        AchetypeXMLPath   = Application.dataPath + "/XML/Archetypes.xml";
        BackgroundXMLPath = Application.dataPath + "/XML/Backgrounds.xml";
        ClanXMLPath       = Application.dataPath + "/XML/Clans.xml";
        ConceptXMLPath    = Application.dataPath + "/XML/Concepts.xml";
        DisciplineXMLPath = Application.dataPath + "/XML/Disciplines.xml";
        PathXMLPath       = Application.dataPath + "/XML/Paths.xml";
        MeritFlawXMLPath  = Application.dataPath + "/XML/MeritsFlaws.xml";
        StatsPath         = Application.dataPath + "/XML/Stats.xml";


        DirectoryInfo dirInf = new DirectoryInfo(Application.dataPath + "/XML");

        if (!dirInf.Exists)  //Check if directory exists
        {
            dirInf.Create();
        }
        if (!File.Exists(CharacterXMLPath))
        {
            //Debug.Log("No Character XML Data. Creating....");
            File.WriteAllText(CharacterXMLPath, CharacterXML.ToString());
            MyCharacters = CharacterContainer.Load(CharacterXMLPath);
        }
        else
        {
            //Debug.Log("Loading Character Data");
            MyCharacters = CharacterContainer.Load(CharacterXMLPath);
        }

        if (!File.Exists(AchetypeXMLPath))
        {
            //Debug.Log("No Archetype XML Data. Creating....");
            File.WriteAllText(AchetypeXMLPath, AchetypeXML.ToString());
            MyArchetypes = ArchetypesContainer.Load(AchetypeXMLPath);
        }
        else
        {
            //Debug.Log("Loading Archetype Data");
            MyArchetypes = ArchetypesContainer.Load(AchetypeXMLPath);
        }

        if (!File.Exists(BackgroundXMLPath))
        {
            //Debug.Log("No Backgrounds XML Data. Creating....");
            File.WriteAllText(BackgroundXMLPath, BackgroundXML.ToString());
            MyBackgrounds = BackgroundContainer.Load(BackgroundXMLPath);
        }
        else
        {
            //Debug.Log("Loading Background Data");
            MyBackgrounds = BackgroundContainer.Load(BackgroundXMLPath);
        }

        if (!File.Exists(ClanXMLPath))
        {
            //Debug.Log("No Clan XML Data. Creating....");
            File.WriteAllText(ClanXMLPath, ClanXML.ToString());
            MyClans = ClanContainer.Load(ClanXMLPath);
        }
        else
        {
            //Debug.Log("Loading Clan Data");
            MyClans = ClanContainer.Load(ClanXMLPath);
        }

        if (!File.Exists(DisciplineXMLPath))
        {
            //Debug.Log("No Discipline XML Data. Creating....");
            File.WriteAllText(DisciplineXMLPath, DisciplineXML.ToString());
            MyDisciplines = DisciplineContainer.Load(DisciplineXMLPath);
        }
        else
        {
            //Debug.Log("Loading Discipline Data");
            MyDisciplines = DisciplineContainer.Load(DisciplineXMLPath);
        }

        if (!File.Exists(PathXMLPath))
        {
            //Debug.Log("No Paths XML Data. Creating....");
            File.WriteAllText(PathXMLPath, PathXML.ToString());
            MyPaths = PathsContainer.Load(PathXMLPath);
        }
        else
        {
            //Debug.Log("Loading Paths Data");
            MyPaths = PathsContainer.Load(PathXMLPath);
        }

        if (!File.Exists(ConceptXMLPath))
        {
            //Debug.Log("No Concept XML Data. Creating....");
            File.WriteAllText(ConceptXMLPath, ConceptXML.ToString());
            MyConcepts = ConceptContainer.Load(ConceptXMLPath);
        }
        else
        {
            //Debug.Log("Loading Concept Data");
            MyConcepts = ConceptContainer.Load(ConceptXMLPath);
        }

        if (!File.Exists(MeritFlawXMLPath))
        {
            //Debug.Log("No MeritFlaw XML Data. Creating....");
            File.WriteAllText(MeritFlawXMLPath, MeritFlawXML.ToString());
            MyMeritFlaws = MeritFlawContainer.Load(MeritFlawXMLPath);
        }
        else
        {
            //Debug.Log("Loading MeritFlaw Data");
            MyMeritFlaws = MeritFlawContainer.Load(MeritFlawXMLPath);
        }
        if (!File.Exists(StatsPath))
        {
            //Debug.Log("No Stats XML Data. Creating....");
            File.WriteAllText(StatsPath, StatsXML.ToString());
            MyStats = StatContainer.Load(StatsPath);
        }
        else
        {
            //Debug.Log("Loading Stats XML Data");
            MyStats = StatContainer.Load(StatsPath);
        }
        Loaded = true;
    }
Ejemplo n.º 21
0
 private void Awake()
 {
     instance   = this;
     characters = new List <Character>();
 }
Ejemplo n.º 22
0
 public virtual void DisplaySmiley(short smileyId)
 {
     CharacterContainer.ForEach(entry => ChatHandler.SendChatSmileyMessage(entry.Client, this, smileyId));
 }
Ejemplo n.º 23
0
 public CharacterUpdated(CharacterContainer character)
 {
     Character = character;
 }
Ejemplo n.º 24
0
    public override void OnInspectorGUI()
    {
//         base.OnInspectorGUI();

        Character          character           = (Character)target;
        CharacterAnimation character_animation = character.GetComponent <CharacterAnimation>();

        EditorGUILayout.BeginVertical();
        // debug
        if (Application.isPlaying)
        {
            s_Util.SeparatorToolbar("Debug", null);

            int selected_container = EditorPrefs.GetInt("Character_ActionTarget", 1);
            int range = EditorPrefs.GetInt("Character_ActionRange", 1);

            EditorGUILayout.BeginHorizontal();
            EditorGUIUtility.labelWidth = 70f;
            Time.timeScale = EditorGUILayout.FloatField("TimeScale", Time.timeScale, GUILayout.Width(110f));
            if (GUILayout.Button("Reset", GUILayout.Width(50f)))
            {
                Time.timeScale = 1f;
            }
            if (GUILayout.Button("Slow", GUILayout.Width(50f)))
            {
                Time.timeScale = 0.1f;
            }
            if (GUILayout.Button("Pause", GUILayout.Width(50f)))
            {
                Time.timeScale = 0f;
            }
            float new_time_skip = EditorGUILayout.FloatField("TimeSkip", time_skip, GUILayout.Width(110f));
            if (GUILayout.Button("Reset", GUILayout.Width(50f)))
            {
                new_time_skip = 0f;
            }
            if (GUILayout.Button("0.5", GUILayout.Width(50f)))
            {
                new_time_skip = 0.5f;
            }
            if (GUILayout.Button("1", GUILayout.Width(50f)))
            {
                new_time_skip = 1f;
            }
            if (time_skip != new_time_skip)
            {
                time_skip = new_time_skip;
            }
            EditorGUIUtility.labelWidth = 0f;
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();

            GameObject countdown_object = null;
#if SH_ASSETBUNDLE
            if (m_Recording != RecordState.None)
            {
                GUI.backgroundColor = Color.green;
            }

            if ((GUILayout.Button("Record") && m_Recording == RecordState.None) && BattleBase.Instance.IsPause == ePauseType.None)
            {
                m_Recording = RecordState.Waiting;
//                m_Recording = RecordState.WaitingWithCamera;

                if (m_Recording == RecordState.WaitingWithCamera)
                {
                    BattleTest.Instance._capture._forceFilename = string.Format("{0}_{1}_scaled.avi", character.name, action_list.Selected.AnimationName);
                }
                else
                {
                    BattleTest.Instance._capture._forceFilename = string.Format("{0}_{1}.avi", character.name, action_list.Selected.AnimationName);
                }
                BattleTest.Instance._capture.SelectCodec(false);
                BattleTest.Instance._capture.SelectAudioDevice(false);
                // We have to queue the start capture otherwise Screen.width and height aren't correct
                BattleTest.Instance._capture.QueueStartCapture();

                BattleTest.Instance.m_Countdown.gameObject.SetActive(true);
                BattleTest.Instance.m_RecordTime.gameObject.SetActive(true);
                Debug.Log("Record Start");
            }
            GUI.backgroundColor = Color.white;
            if (m_Recording == RecordState.Waiting || m_Recording == RecordState.WaitingWithCamera)
            {
                countdown_object = BattleTest.Instance.m_Countdown.gameObject;
            }
#endif
            if ((GUILayout.Button("Play") || m_Recording == RecordState.Waiting && countdown_object.activeInHierarchy == false) && BattleBase.Instance.IsPause == ePauseType.None)
            {
                if (m_Recording == RecordState.Waiting)
                {
                    m_Recording = RecordState.Recording;
                }

                CharacterContainer action_target = containers[selected_container];

                List <CharacterContainer> target_containers = containers.Where(c => c.transform.parent.name == action_target.transform.parent.name).ToList();
                SkillTargetContainer      skill_target      = new SkillTargetContainer();
                skill_target.targets = new List <ISkillTarget>();

                skill_target.targets.Add(new SkillTargetDummy(character, action_target.Character));
                int target_index = target_containers.FindIndex(c => c == action_target);
                for (int i = 1; i < range; ++i)
                {
                    if (target_index - i >= 0)
                    {
                        skill_target.targets.Add(new SkillTargetDummy(character, target_containers[target_index - i].Character));
                    }
                    else
                    {
                        skill_target.targets.Add(null);
                    }
                    if (target_index + i < target_containers.Count)
                    {
                        skill_target.targets.Add(new SkillTargetDummy(character, target_containers[target_index + i].Character));
                    }
                    else
                    {
                        skill_target.targets.Add(null);
                    }
                }

                if (skill_target.targets != null)
                {
                    skill_target.main_target = skill_target.targets[0].Character.transform;
                    character.DoActionEditor(action_list.SelectedIndex, skill_target, false, character.Creature.Scale - 1f, SkillTargetDummy.BuffDuration);
                    if (new_time_skip > 0f)
                    {
                        character.Creature.PlaybackTime += new_time_skip;
                    }
                }
            }
            if ((GUILayout.Button("Play With Camera") || m_Recording == RecordState.WaitingWithCamera && countdown_object.activeInHierarchy == false) && BattleBase.Instance.IsPause == ePauseType.None)
            {
                if (m_Recording == RecordState.WaitingWithCamera)
                {
                    m_Recording = RecordState.Recording;
                }

                CharacterContainer action_target = containers[selected_container];

                List <CharacterContainer> target_containers = containers.Where(c => c.transform.parent.name == action_target.transform.parent.name).ToList();
                SkillTargetContainer      skill_target      = new SkillTargetContainer();
                skill_target.targets = new List <ISkillTarget>();

                skill_target.targets.Add(new SkillTargetDummy(character, action_target.Character));
                int target_index = target_containers.FindIndex(c => c == action_target);
                for (int i = 1; i < range; ++i)
                {
                    if (target_index - i >= 0)
                    {
                        skill_target.targets.Add(new SkillTargetDummy(character, target_containers[target_index - i].Character));
                    }
                    else
                    {
                        skill_target.targets.Add(null);
                    }
                    if (target_index + i < target_containers.Count)
                    {
                        skill_target.targets.Add(new SkillTargetDummy(character, target_containers[target_index + i].Character));
                    }
                    else
                    {
                        skill_target.targets.Add(null);
                    }
                }

                if (skill_target.targets != null)
                {
                    skill_target.main_target = skill_target.targets[0].Character.transform;
                    character.DoActionEditor(action_list.SelectedIndex, skill_target, true, BattleBase.LightingScaleValue, SkillTargetDummy.BuffDuration);
                    BattleBase.Instance.AddLighting(character.Creature, character.MainAction.FirstActionTime, character.MainAction.Data.Effect.ScaleTime, character.MainAction.Data.Effect.JumpScale);
                    BattleBase.Instance.AddLightingTargets(character.Creature.IsTeam, skill_target.targets, character.Creature);
                    if (new_time_skip > 0f)
                    {
                        character.Creature.PlaybackTime += new_time_skip;
                    }
                }
            }
            if (GUILayout.Button("Cancel"))
            {
                character.CancelAction(false);
            }
            EditorGUILayout.EndHorizontal();

            if (BattleBase.Instance != null)
            {
                EditorGUILayout.BeginHorizontal();
                BattleBase.Instance.tween_system.DefaultBundleIndex = EditorGUILayout.Popup("tween", BattleBase.Instance.tween_system.DefaultBundleIndex, BattleBase.Instance.tween_system.bundles.Select(b => b.Name).ToArray());
                if (GUILayout.Button("Play"))
                {
                    BattleBase.Instance.tween_system.Play(BattleBase.Instance.tween_system.DefaultBundleIndex, null, character.GetComponent <HFX_TweenSystem>(), character.transform.GetChild(0));
                }
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.BeginHorizontal();
            if (character.Creature != null)
            {
                eInspectorMapCreatureType scale_type = eInspectorMapCreatureType.Normal;
                if (character.Creature.Scale == 1f)
                {
                    scale_type = eInspectorMapCreatureType.Normal;
                }
                else if (character.Creature.Scale == 1.2f)
                {
                    scale_type = eInspectorMapCreatureType.Elite;
                }
                else if (character.Creature.Scale == 1.4f)
                {
                    scale_type = eInspectorMapCreatureType.Boss;
                }

                eInspectorMapCreatureType new_scale_type = (eInspectorMapCreatureType)EditorGUILayout.EnumPopup("Scale", scale_type);
                if (scale_type != new_scale_type)
                {
                    float new_scale = 1f;
                    if (new_scale_type == eInspectorMapCreatureType.Normal)
                    {
                        new_scale = 1f;
                    }
                    else if (new_scale_type == eInspectorMapCreatureType.Elite)
                    {
                        new_scale = 1.2f;
                    }
                    else if (new_scale_type == eInspectorMapCreatureType.Boss)
                    {
                        new_scale = 1.4f;
                    }

                    character.Creature.Scale       = new_scale;
                    character.transform.localScale = Vector3.one * new_scale;
                }
                character.Creature.IsDead = EditorGUILayout.Toggle("Dead", character.Creature.IsDead);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            List <string> container_names = new List <string>();
            container_names.AddRange(containers.Select(c => c.transform.parent.name + "/" + c.name));
            container_names.Add("Self");
            container_names.Add("Enemy1");
            container_names.Add("Enemy5");
            container_names.Add("Mine1");
            container_names.Add("Mine5");

            selected_container = EditorGUILayout.Popup(selected_container, container_names.ToArray());
            if (selected_container >= 0 && selected_container < container_names.Count)
            {
                switch (container_names[selected_container])
                {
                case "Self":
                    selected_container = container_names.IndexOf(character.transform.parent.parent.name + "/" + character.transform.parent.name);
                    break;

                case "Mine1":
                    selected_container = container_names.IndexOf("Mine/Character1");
                    break;

                case "Mine5":
                    selected_container = container_names.IndexOf("Mine/Character5");
                    break;

                case "Enemy1":
                    selected_container = container_names.IndexOf("Enemy/Character1");
                    break;

                case "Enemy5":
                    selected_container = container_names.IndexOf("Enemy/Character5");
                    break;
                }
            }
            EditorPrefs.SetInt("Character_ActionTarget", selected_container);

            range = EditorGUILayout.IntSlider(range, 1, 5);
            EditorPrefs.SetInt("Character_ActionRange", range);
            EditorGUILayout.EndHorizontal();

            if (character.PlayingActions.Count > 0)
            {
                foreach (var action in character.PlayingActions)
                {
                    EditorGUILayout.LabelField(string.Format("{0} - {1}", action.Name, action.Length));
                }
                EditorUtility.SetDirty((MonoBehaviour)character);
            }
#if SH_ASSETBUNDLE
            else if (m_Recording == RecordState.Recording)
            {
                m_Recording        = RecordState.Finishing;
                m_RecordFinishTime = Time.time + 3f;
                BattleTest.Instance.m_RecordTime.SetFinish();
            }

            if (m_Recording == RecordState.Finishing && Time.time > m_RecordFinishTime)
            {
                m_Recording = RecordState.None;
                BattleTest.Instance._capture.StopCapture();
                BattleTest.Instance.m_RecordTime.gameObject.SetActive(false);
                Debug.Log("Record Finished");
            }
#endif
        }

        s_Util.SeparatorToolbar("System", null);
        if (GUILayout.Button("Set Sound"))
        {
            foreach (var action in character.Actions)
            {
                string    audio_path = string.Format("Assets/Sounds/Character/{0}_{1}.wav", character.name, action.AnimationName);
                AudioClip audio      = AssetDatabase.LoadAssetAtPath(audio_path, typeof(AudioClip)) as AudioClip;
                if (audio != null)
                {
                    if (action.Effect.Casting.Length == 0 || action.Effect.Casting[0].time != 0)
                    {
                        var temp_action_list = action.Effect.Casting.ToList();
                        temp_action_list.Add(new CharacterAction_EffectCasting());
                        action.Effect.Casting = temp_action_list.ToArray();
                    }
                    if (action.Effect.Casting[0].sound_list[0].sound == null)
                    {
                        action.Effect.Casting[0].sound_list[0].sound = audio;
                        Debug.LogFormat("Set Sound : {0}", audio.name);
                    }
                }
            }
        }
        GUILayout.BeginHorizontal();
        character.m_DefaultEffect = EditorGUILayout.ObjectField("Default Effect", character.m_DefaultEffect, typeof(HFX_ParticleSystem), false) as HFX_ParticleSystem;
        if (GUILayout.Button("Add to scene", GUILayout.Width(150f)))
        {
            AddParticleSystemToScene(character, character.m_DefaultEffect, 0f);
        }
        GUILayout.EndHorizontal();

        CharacterActionData selected_action = action_list.OnInspectorGUI();

        if (selected_action != null)
        {
            selected_action.AnimationName   = CharacterAnimationInspector.OnInspectorAnimation(character_animation, selected_action.AnimationName);
            selected_action.CameraAnimation = EditorGUILayout.ObjectField("Camera Animation", selected_action.CameraAnimation, typeof(AnimationClip), false) as AnimationClip;
            if (selected_action.CameraAnimation != null)
            {
                selected_action.ActionMode   = (BattleBase.eActionMode)EditorGUILayout.EnumPopup("ActionMode", selected_action.ActionMode);
                selected_action.DelayedApply = EditorGUILayout.Toggle("Delayed Apply", selected_action.DelayedApply);
            }
            selected_action.Effect.ScaleTime       = EditorGUILayout.FloatField("Scale Time", selected_action.Effect.ScaleTime);
            selected_action.Effect.MoveScale       = EditorGUILayout.FloatField("Move Scale", selected_action.Effect.MoveScale);
            selected_action.Effect.JumpScale       = EditorGUILayout.FloatField("Jump Scale", selected_action.Effect.JumpScale);
            selected_action.Effect.FxHeight        = EditorGUILayout.FloatField("Fx Height", selected_action.Effect.FxHeight);
            selected_action.Effect.UseSingTarget   = EditorGUILayout.Toggle("Use Single Target", selected_action.Effect.UseSingTarget);
            selected_action.Effect.TargetTimeGap   = EditorGUILayout.FloatField("Time Gap", selected_action.Effect.TargetTimeGap);
            selected_action.Effect.TargetTimeGroup = EditorGUILayout.IntField("Time Group", selected_action.Effect.TargetTimeGroup);

            action_effect_casting_list.character = character;
            action_effect_casting_list.container = selected_action.Effect;
            action_effect_casting_list.OnInspectorGUI();

            action_effect_target_list.character = character;
            action_effect_target_list.container = selected_action.Effect;
            action_effect_target_list.OnInspectorGUI();

            action_effect_hit_list.character = character;
            action_effect_hit_list.container = selected_action.Effect;
            action_effect_hit_list.OnInspectorGUI();

            action_effect_buff_list.character = character;
            action_effect_buff_list.container = selected_action.Effect;
            action_effect_buff_list.OnInspectorGUI();

            action_effect_camera_list.character = character;
            action_effect_camera_list.container = selected_action.Effect;
            action_effect_camera_list.OnInspectorGUI();
        }

        EditorGUILayout.EndVertical();

        EditorGUIUtility.labelWidth = 0f;
        EditorUtility.SetDirty((MonoBehaviour)character);
    }
Ejemplo n.º 25
0
    virtual public void SetActionMode(bool set_mode, eActionMode mode, ICreature leader_creature, bool need_backup_scale)
    {
        if (BattleBase.CurrentBattleMode == eBattleMode.None)
        {
            return;
        }

        if (set_mode)
        {
            IsPause           = ePauseType.Pause;
            m_Light.intensity = 1f;
            TextManager.Instance.Clear();

            backup_container = leader_creature.Container;

            foreach (var creature in m_LightingCreatures)
            {
                creature.Creature.Character.transform.localScale = Vector3.one * creature.Creature.Scale;
            }

            List <ICreature> team_creatures  = null;
            List <ICreature> enemy_creatures = null;

            if (leader_creature.IsTeam)
            {
                leader_creature.Character.transform.SetParent(battle_layout.m_Mine.Center.transform, false);
                team_creatures  = characters;
                enemy_creatures = enemies;
            }
            else
            {
                leader_creature.Character.transform.SetParent(battle_layout.m_Enemy.Center.transform, false);
                team_creatures  = enemies;
                enemy_creatures = characters;
            }

            backup_scale = leader_creature.Scale;
            if (need_backup_scale)
            {
                leader_creature.Character.transform.localScale = Vector3.one;
                leader_creature.Scale = 1f;
            }

            foreach (var creature in team_creatures)
            {
                eCharacterDummyMode dummy_mode = eCharacterDummyMode.Hidden;
                if (creature == leader_creature)
                {
                    dummy_mode = eCharacterDummyMode.Active;
                }
                else if (mode == eActionMode.NotHidden || mode == eActionMode.EnemyHidden)
                {
                    dummy_mode = eCharacterDummyMode.Dummy;
                }

                creature.SetDummyMode(dummy_mode);
                if (dummy_mode == eCharacterDummyMode.Active)
                {
                    LightingTarget.SetType(creature.Character, eLightingType.Active);
                }
            }

            foreach (var creature in enemy_creatures)
            {
                eCharacterDummyMode dummy_mode = eCharacterDummyMode.Hidden;
                if (mode == eActionMode.NotHidden || mode == eActionMode.TeamHidden)
                {
                    dummy_mode = eCharacterDummyMode.Dummy;
                }
                creature.SetDummyMode(dummy_mode);
            }

            foreach (var particle in m_PlayingParticles)
            {
                particle.SetHidden(true);
            }

            m_SkillCamera.transform.localPosition = Vector3.zero;
            m_SkillCamera.transform.localRotation = Quaternion.identity;
            m_SkillCamera.gameObject.SetActive(true);
            backup_camera         = Camera.main;
            backup_camera.enabled = false;
            if (m_Bottom != null)
            {
                m_Bottom.SetActive(false);
            }
        }
        else
        {
            backup_camera.enabled = true;
            m_SkillCamera.gameObject.SetActive(false);
            IsPause = ePauseType.None;
            if (m_Bottom != null)
            {
                m_Bottom.SetActive(true);
            }

            leader_creature.Character.transform.SetParent(backup_container.transform, false);
            leader_creature.Scale = backup_scale;
            leader_creature.Character.transform.localScale = Vector3.one * backup_scale;
            backup_container = null;

            //             LightingTarget.SetType(leader_creature.Character, eLightingType.None);

            List <ICreature> team_creatures  = null;
            List <ICreature> enemy_creatures = null;
            if (leader_creature.IsTeam)
            {
                team_creatures  = characters;
                enemy_creatures = enemies;
            }
            else
            {
                team_creatures  = enemies;
                enemy_creatures = characters;
            }

            foreach (var creature in team_creatures)
            {
                if (creature != null)
                {
                    creature.SetDummyMode(eCharacterDummyMode.None);
                    var target = m_LightingTargets.Find(t => t.Character == creature.Character);
                    if (target != null)
                    {
                        target.SetType();
                    }
                    else
                    {
                        LightingTarget.SetType(creature.Character, eLightingType.None);
                    }
                }
            }
            foreach (var creature in enemy_creatures)
            {
                if (creature != null)
                {
                    creature.SetDummyMode(eCharacterDummyMode.None);
                    var target = m_LightingTargets.Find(t => t.Character == creature.Character);
                    if (target != null)
                    {
                        target.SetType();
                    }
                    else
                    {
                        LightingTarget.SetType(creature.Character, eLightingType.None);
                    }
                }
            }

            foreach (var particle in m_PlayingParticles)
            {
                particle.SetHidden(false);
            }
        }
    }