Пример #1
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.LabelField("Mission Source", ResourcesManager.GetInstance.skin.GetStyle("Title"));

            GUILayout.Space(10);

            if (GUILayout.Button("Value >>>", GUILayout.Height(40), GUILayout.Width(80)))
            {
                CryStory.Editor.ValueManagerWindow.Open();
            }

            GUILayout.Space(10);

            MissionObject m = (MissionObject)target;

            if (m._nextMissionNodeList.Count > 0)
            {
                EditorGUILayout.LabelField("Next Missions:", ResourcesManager.GetInstance.GetFontStyle(12, new Color32(238, 130, 238, 255)));
                for (int i = 0; i < m._nextMissionNodeList.Count; i++)
                {
                    NextMissionData data = m._nextMissionNodeList[i];
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Space(10);
                    EditorGUILayout.LabelField(data.Name, data.IsSingleNode ? "[<color=#00FF00>Single</color>]" : "[<color=#00BFFF>Double</color>]", ResourcesManager.GetInstance.GetFontStyle(11));
                    EditorGUILayout.EndHorizontal();
                }
            }

            GUILayout.Space(10);

            string path = Application.dataPath + "/../" + AssetDatabase.GetAssetPath(target);

            System.DateTime modifyDate = System.IO.File.GetLastAccessTime(path);
            EditorGUILayout.LabelField("Modify Date:", modifyDate.ToString("yyyy.MM.dd   H:m:s"));
        }
Пример #2
0
 public static void HandleMissileCollisionReaction(
     ref int missileIndex,
     ref Mission.MissileCollisionReaction collisionReaction,
     ref MatrixFrame attachLocalFrame,
     ref Agent attackerAgent,
     ref Agent attachedAgent,
     ref bool attachedToShield,
     ref sbyte attachedBoneIndex,
     ref MissionObject attachedMissionObject,
     ref Vec3 bounceBackVelocity,
     ref Vec3 bounceBackAngularVelocity,
     ref int forcedSpawnIndex)
 {
     try
     {
         if (attachedAgent.IsPlayer() &&
             collisionReaction == Mission.MissileCollisionReaction.Stick &&
             BannerlordCheatsSettings.Instance?.NoStuckArrows == true)
         {
             collisionReaction = Mission.MissileCollisionReaction.BecomeInvisible;
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(NoStuckArrows));
     }
 }
Пример #3
0
    MissionObjectData MODLabel(MissionObjectData mod)
    {
        MissionObjectData res = mod;

        EditorGUILayout.BeginHorizontal();
        int id = 0;

        if (int.TryParse(GUILayout.TextField(mod.ID.ToString(), GUILayout.Width(30)), out id))
        {
            res.ID = id;
        }
        EditorGUILayout.Space();
        Vector3 pos;

        res.Position = EditorGUILayout.Vector3Field("", mod.Position, GUILayout.Width(200));
        EditorGUILayout.Space();
        res.Name = EditorGUILayout.TextField(mod.Name, GUILayout.Width(100));
        EditorGUILayout.Space();
        MissionObject mo2 = DataStorageController.GetMissionObjectByID(mod.ID);

        if (mo2 != null)
        {
            EditorGUILayout.ObjectField(mo2.gameObject, typeof(GameObject), true, GUILayout.Width(100));
        }
        else
        {
            EditorGUILayout.LabelField("None", GUILayout.Width(100));
        }
        EditorGUILayout.EndHorizontal();
        return(res);
    }
 public CreateMissile(
     int missileIndex,
     Agent agent,
     EquipmentIndex weaponIndex,
     MissionWeapon weapon,
     Vec3 position,
     Vec3 direction,
     float speed,
     Mat3 orientation,
     bool hasRigidBody,
     MissionObject missionObjectToIgnore,
     bool isPrimaryWeaponShot)
 {
     this.MissileIndex          = missileIndex;
     this.Agent                 = agent;
     this.WeaponIndex           = weaponIndex;
     this.Weapon                = weapon;
     this.Position              = position;
     this.Direction             = direction;
     this.Speed                 = speed;
     this.Orientation           = orientation;
     this.HasRigidBody          = hasRigidBody;
     this.MissionObjectToIgnore = missionObjectToIgnore;
     this.IsPrimaryWeaponShot   = isPrimaryWeaponShot;
 }
Пример #5
0
 public MissionObjectDto(Mission adjectedMission, bool test = true)
 {
     _missionObject = new MissionObject()
     {
         Mission = adjectedMission, Mission_Id = adjectedMission.Id, SimObject_Id = 1
     };
 }
Пример #6
0
 public void DestroyMissionObject(MissionObject missionObject)
 {
     if (missionObject.spawnedInstance)
     {
         Destroy(missionObject.spawnedInstance);
     }
 }
Пример #7
0
 public HandleMissileCollisionReaction(
     int missileIndex,
     Mission.MissileCollisionReaction collisionReaction,
     MatrixFrame attachLocalFrame,
     Agent attackerAgent,
     Agent attachedAgent,
     bool attachedToShield,
     sbyte attachedBoneIndex,
     MissionObject attachedMissionObject,
     Vec3 bounceBackVelocity,
     Vec3 bounceBackAngularVelocity,
     int forcedSpawnIndex)
 {
     this.MissileIndex              = missileIndex;
     this.CollisionReaction         = collisionReaction;
     this.AttachLocalFrame          = attachLocalFrame;
     this.AttackerAgent             = attackerAgent;
     this.AttachedAgent             = attachedAgent;
     this.AttachedToShield          = attachedToShield;
     this.AttachedBoneIndex         = attachedBoneIndex;
     this.AttachedMissionObject     = attachedMissionObject;
     this.BounceBackVelocity        = bounceBackVelocity;
     this.BounceBackAngularVelocity = bounceBackAngularVelocity;
     this.ForcedSpawnIndex          = forcedSpawnIndex;
 }
Пример #8
0
    void SetMission()
    {
        //Select Mission
        indexOfMission = UnityEngine.Random.Range(0, missionData.Count - 3);
        mission        = new Missions(missionData[indexOfMission]);

        //Find MissionObject & Initiallize
        int cnt1 = mission.GetMissionCount();

        missionObjects = new MissionObject[cnt1][];
        for (int i = 0; i < cnt1; i++)
        {
            int cnt2 = mission.GetDuplicateObjectsCount(i);
            missionObjects[i] = new MissionObject[cnt2];

            Vector3 playerPos = mission.GetStartPosition();
            if (i != 0)
            {
                playerPos = missionObjects[i - 1][0].GetSD();
            }
            for (int j = 0; j < cnt2; j++)
            {
                missionObjects[i][j] = new MissionObject(objectData, mission.GetObjectIndex(i, j), playerPos);
            }
        }

        mission.SetMissionPosition(missionObjects);
        for (int i = 0; i < missionObjects.Length; i++)
        {
            //Debug.Log(missionObjects[i].GetName());
        }
    }
 public static bool Prefix2(int missileIndex, ref Mission.MissileCollisionReaction collisionReaction,
                            MatrixFrame attachLocalFrame, Agent attackerAgent, Agent attachedAgent, bool attachedToShield,
                            sbyte attachedBoneIndex, MissionObject attachedMissionObject, Vec3 bounceBackVelocity, Vec3 bounceBackAngularVelocity, int forcedSpawnIndex)
 {
     try
     {
         if (attachedAgent != null && attackerAgent != null &&
             (!HeroicHeroesSettings.Instance.HeroProjectilesExemption || (attackerAgent.IsHuman && !attackerAgent.IsHero)))
         {
             if (attachedAgent.IsMount)
             {
                 if (HeroicHeroesSettings.Instance.MountProjectiles)
                 {
                     if (attachedAgent.RiderAgent != null)
                     {
                         if ((attachedAgent.RiderAgent.IsMainAgent && HeroicHeroesSettings.Instance.MainProjectiles ||
                              (attachedAgent.RiderAgent.IsHero && HeroicHeroesSettings.Instance.HeroProjectiles) ||
                              HeroicHeroesSettings.Instance.AIProjectiles) &&
                             checkFriendly(HeroicHeroesSettings.Instance.FriendlyProjectiles, attachedAgent.RiderAgent)
                             )
                         {
                             collisionReaction = Mission.MissileCollisionReaction.BecomeInvisible;
                         }
                     }
                 }
             }
             else if (attachedAgent.IsMainAgent)
             {
                 if (HeroicHeroesSettings.Instance.MainProjectiles)
                 {
                     collisionReaction = Mission.MissileCollisionReaction.BecomeInvisible;
                 }
             }
             else if (attachedAgent.IsHero)
             {
                 if (HeroicHeroesSettings.Instance.HeroProjectiles)
                 {
                     if (checkFriendly(HeroicHeroesSettings.Instance.FriendlyOnly, attachedAgent))
                     {
                         collisionReaction = Mission.MissileCollisionReaction.BecomeInvisible;
                     }
                 }
             }
             else if (HeroicHeroesSettings.Instance.AIProjectiles && checkFriendly(HeroicHeroesSettings.Instance.FriendlyOnly, attachedAgent))
             {
                 collisionReaction = Mission.MissileCollisionReaction.BecomeInvisible;
             }
         }
     }
     catch (Exception arg)
     {
         if (HeroicHeroesSettings.Instance.showError)
         {
             MessageBox.Show(string.Format("Error with HandleMissileCollisionReaction:\n\n{0}", arg));
         }
     }
     return(true);
 }
Пример #10
0
 public RemoveMissionObjectBodyFlags(
     MissionObject missionObject,
     BodyFlags bodyFlags,
     bool applyToChildren)
 {
     this.MissionObject   = missionObject;
     this.BodyFlags       = bodyFlags;
     this.ApplyToChildren = applyToChildren;
 }
 public SetMissionObjectAnimationChannelParameter(
     MissionObject missionObject,
     int channelNo,
     float parameter)
 {
     this.MissionObject = missionObject;
     this.ChannelNo     = channelNo;
     this.Parameter     = parameter;
 }
Пример #12
0
 public StopPhysicsAndSetFrameOfMissionObject(
     MissionObjectId objectId,
     MissionObject parent,
     MatrixFrame frame)
 {
     this.ObjectId = objectId;
     this.Parent   = parent;
     this.Frame    = frame;
 }
Пример #13
0
 public AttachWeaponToSpawnedWeapon(
     MissionWeapon weapon,
     MissionObject missionObject,
     MatrixFrame attachLocalFrame)
 {
     this.Weapon           = weapon;
     this.MissionObject    = missionObject;
     this.AttachLocalFrame = attachLocalFrame;
 }
 public SetMissionObjectGlobalFrameOverTime(
     MissionObject missionObject,
     ref MatrixFrame frame,
     float duration)
 {
     this.MissionObject = missionObject;
     this.Frame         = frame;
     this.Duration      = duration;
 }
Пример #15
0
 /// <summary>
 /// 检测当前任务项是否完成
 /// </summary>
 /// <returns><c>true</c>, if finish task was ised, <c>false</c> otherwise.</returns>
 /// <param name="type">Type.</param>
 /// <param name="item">Item.</param>
 private bool IsFinishTask(TaskType type, MissionObject item)
 {
     if (int.Parse(GetTaskValue(type, item, 0)) - int.Parse(GetTaskValue(type, item, 1)) == 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #16
0
 public SetMissionObjectAnimationAtChannel(
     MissionObject missionObject,
     int channelNo,
     int animationIndex,
     float animationSpeed)
 {
     this.MissionObject  = missionObject;
     this.ChannelNo      = channelNo;
     this.AnimationIndex = animationIndex;
     this.AnimationSpeed = animationSpeed;
 }
Пример #17
0
 //设置每个按钮的事件
 private void SetEventToButton(GameObject achieve, MissionObject item)
 {
     //给按钮添加默认的点击音频
     AudioManager.Instance.InitBtnClick(achieve);
     achieve.GetComponent <Button>().onClick.AddListener(() =>
     {
         print("OK");
         SetAchievementItemSelectStatus(achieve);
         PageManager.Instance.CurrentPage.GetNode <AchievementItemNode>().SetAchievementItemInfor(item);
     });
 }
 public SetMissionObjectImpulse(
     MissionObject missionObject,
     Vec3 position,
     Vec3 impulse,
     bool localSpace)
 {
     this.MissionObject = missionObject;
     this.Position      = position;
     this.Impulse       = impulse;
     this.LocalSpace    = localSpace;
 }
 public SetMissionObjectVertexAnimation(
     MissionObject missionObject,
     int beginKey,
     int endKey,
     float speed)
 {
     this.MissionObject = missionObject;
     this.BeginKey      = beginKey;
     this.EndKey        = endKey;
     this.Speed         = speed;
 }
Пример #20
0
    /// <summary>
    /// 设置正常任务项的种类(主线或者特殊)
    /// </summary>
    /// <param name="obj">Object.</param>
    /// <param name="item">Item.</param>
    /// <param name="type">Type.</param>
    private void SetTaskType(GameObject obj, MissionObject item, MissionType type)
    {
        switch (type)
        {
        case MissionType.Main:
            obj.transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite>("Task/" + MissionType.Main.ToString());
            break;

        case MissionType.Special:
            obj.transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite>("Task/" + MissionType.Special.ToString());
            break;
        }
    }
Пример #21
0
        public static SynchedMissionObject ReadSynchedMissionObjectFromPacket(
            ref bool bufferReadValid)
        {
            MissionObject missionObject = GameNetworkMessage.ReadMissionObjectReferenceFromPacket(ref bufferReadValid);

            if (!bufferReadValid || missionObject == null)
            {
                return((SynchedMissionObject)null);
            }
            SynchedMissionObject synchedMissionObject = (SynchedMissionObject)missionObject;

            bufferReadValid = synchedMissionObject.ReadFromNetwork();
            return(synchedMissionObject);
        }
Пример #22
0
 /// <summary>
 /// 创建正常的任务项
 /// </summary>
 /// <param name="type">Type.</param>
 /// <param name="obj">Object.</param>
 /// <param name="item">Item.</param>
 private void CreateDailyTaskItem(TaskType type, GameObject obj, MissionObject item)
 {
     SetTaskType(obj, item, item.missionType);
     obj.transform.GetChild(2).gameObject.SetActive(true);
     obj.transform.GetChild(3).gameObject.SetActive(false);
     obj.transform.GetChild(0).gameObject.SetActive(true);
     obj.transform.GetChild(1).gameObject.SetActive(false);
     //设置任务的icon为正常任务对应的icon
     //TODO
     obj.transform.GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite>("Task/TaskIcon");
     obj.transform.GetChild(2).GetChild(0).GetChild(0).GetComponent <Text>().text = item.title;
     obj.transform.GetChild(2).GetChild(1).GetComponent <Text>().text             = item.description;
     SetTaskSilderAndStatus(type, obj, item);
     taskItemList.Add(obj);
 }
Пример #23
0
 /// <summary>
 /// 设置任务的完成状态和奖励领取状态
 /// </summary>
 /// <param name="type">Type.</param>
 /// <param name="obj">Object.</param>
 /// <param name="item">Item.</param>
 private void SetTaskSilderAndStatus(TaskType type, GameObject obj, MissionObject item)
 {
     obj.transform.GetChild(2).GetChild(4).GetChild(0).GetComponent <Text>().text = GetTaskValue(type, item, 0) + "/" + GetTaskValue(type, item, 1);
     obj.transform.GetChild(2).GetChild(5).gameObject.SetActive(IsFinishTask(type, item));
     obj.transform.GetChild(2).GetChild(2).GetComponent <Image>().sprite = Resources.Load <Sprite>("Task/" + GetTaskRewordStatus(type, item));
     if (IsFinishTask(type, item) && GetTaskValue(type, item, 2) == "0")
     {
         //如果奖励没有被领取
         obj.transform.GetChild(2).GetChild(2).gameObject.AddComponent <Button>().onClick.AddListener(() =>
         {
             print(item.ID);
             RewordResult(item);
         });
     }
 }
 public SyncObjectDestructionLevel(
     MissionObject missionObject,
     int destructionLevel,
     int forcedIndex,
     float blowMagnitude,
     Vec3 blowPosition,
     Vec3 blowDirection)
 {
     this.MissionObject    = missionObject;
     this.DestructionLevel = destructionLevel;
     this.ForcedIndex      = forcedIndex;
     this.BlowMagnitude    = blowMagnitude;
     this.BlowPosition     = blowPosition;
     this.BlowDirection    = blowDirection;
 }
Пример #25
0
 /// <summary>
 /// 获取任务奖励的领取状态对应的图片资源的名称
 /// </summary>
 /// <returns>The task reword status.</returns>
 /// <param name="type">Type.</param>
 /// <param name="item">Item.</param>
 private string GetTaskRewordStatus(TaskType type, MissionObject item)
 {
     if (!IsFinishTask(type, item))
     {
         return("weiwancheng");
     }
     else if (IsFinishTask(type, item) && GetTaskValue(type, item, 2) == "1")
     {
         return("yilingqu");
     }
     else if (IsFinishTask(type, item) && GetTaskValue(type, item, 2) == "0")
     {
         return("weilingqu");
     }
     return(null);
 }
 public SpawnWeaponWithNewEntity(
     MissionWeapon weapon,
     Mission.WeaponSpawnFlags weaponSpawnFlags,
     int forcedIndex,
     MatrixFrame frame,
     MissionObject parentMissionObject,
     bool isVisible,
     bool hasLifeTime)
 {
     this.Weapon              = weapon;
     this.WeaponSpawnFlags    = weaponSpawnFlags;
     this.ForcedIndex         = forcedIndex;
     this.Frame               = frame;
     this.ParentMissionObject = parentMissionObject;
     this.IsVisible           = isVisible;
     this.HasLifeTime         = hasLifeTime;
 }
Пример #27
0
        private void MissionValue()
        {
            MissionObject  missionObj = Selection.activeObject as MissionObject;
            ValueContainer container;

            if (missionObj != null)
            {
                if (missionObj._mission == null)
                {
                    missionObj.Load();
                }
                container = missionObj._mission;
            }
            else
            {
                container = StoryEditor.GetInstance.CurrentValueContainer;
            }

            if (container == null)
            {
                container = missionContainer;
            }

            if (container == null)
            {
                EditorGUILayout.LabelField("Not select Mission!", GUILayout.Width(300));
                return;
            }

            EditorGUILayout.BeginVertical(GUI.skin.box, GUILayout.Width(300));

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("<color=#FF00FF>" + container._name + "</color>", ResourcesManager.GetInstance.GetFontStyle(18));

            if (GUILayout.Button("<color=#00FF00>Add Value</color>", ResourcesManager.GetInstance.skin.button, GUILayout.Height(25)))
            {
                ValueAdder.Open(container);
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(10);

            ShowContainer(container);

            EditorGUILayout.EndVertical();
        }
Пример #28
0
        private void ShowCreateMissionMenu()
        {
            Vector2 mousePos = Event.current.mousePosition;

            if (mousePos.x < _contentRect.x)
            {
                return;
            }
            if (mousePos.y < _contentRect.y)
            {
                return;
            }
            GenericMenu menu = new GenericMenu();

            menu.AddItem(new GUIContent("Create/New Mission"), false, () =>
            {
                MissionObject mo = ScriptableObject.CreateInstance <MissionObject>();
                mo._mission      = new Mission();

                _currentNode           = mo._mission;
                _currentNode._position = CalcVirtualPosition(mousePos);
                _currentNode._name     = "New Mission";
                _currentNode.SetID(_window._Story.GenerateID());
                Mission.SetContent(_currentNode, _window._Story);

                int index = 1;
                while (_window._storyObject.GetMissionSaveDataByName(mo._mission._name) != null)
                {
                    mo._mission._name = mo._mission._name + "_" + index++;
                }

                while (!CreateMissionObjectFile(mo))
                {
                    mo._mission._name = mo._mission._name + "_" + index++;
                }

                _window._storyObject.AssignNewMissionObject(mo);

                //避免新的实例与Object实例不同
                _currentNode.RemoveFromContent();
                _currentNode = mo._mission;
                Mission.SetContent(_currentNode, _window._Story);
            });
            menu.ShowAsContext();
        }
Пример #29
0
 //设置成就项的状态
 private void SetAchievementState(GameObject achieve, MissionObject item, bool isLight)
 {
     item.isDone = isLight;
     if (isLight)
     {
         //累计已完成的成就数
         isFinishAchieveCount++;
         //将已完成的成就项的icon改变
         achieve.GetComponent <Image>().sprite = Resources.Load <Sprite>("Achievement/kx4X");
         achieve.transform.GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite>("Achievement/ih8swr");
     }
     else
     {
         print("此成就还未获得!!!");
         achieve.GetComponent <Image>().sprite = Resources.Load <Sprite>("Achievement/uTkx4X");
         achieve.transform.GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite>("Achievement/fw658");
     }
 }
Пример #30
0
    /// <summary>
    /// 初始化任务数据源
    /// </summary>
    /// <param name="taskType">任务类型</param>
    private void InitUserDataClass(TaskType taskType)
    {
        string json = File.ReadAllText(Application.dataPath + "/Resources/Config/TaskConfig.json");

        TaskConfig.Instance.Fill(json);
        userAchievementData = new UserAchievementData();
        userAchievementData.userAchievementList = new List <MissionObject>();
        taskIdArray = new int[ServerMutually.ResponseMessageFromServer(taskType).Keys.Count];
        ServerMutually.ResponseMessageFromServer(taskType).Keys.CopyTo(taskIdArray, 0);
        for (int i = 0; i < taskIdArray.Length; i++)
        {
            MissionObject missionObject = new MissionObject();
            missionObject.ID          = taskIdArray[i];
            missionObject.missionType = GetTaskType(int.Parse(TaskConfig.Instance.GetTaskConfigByIdAndKey(taskIdArray[i], "task_type")));
            missionObject.title       = TaskConfig.Instance.GetTaskConfigByIdAndKey(taskIdArray[i], "task_name");
            missionObject.description = TaskConfig.Instance.GetTaskConfigByIdAndKey(taskIdArray[i], "task_desc");
            userAchievementData.userAchievementList.Add(missionObject);
        }
    }
Пример #31
0
 public LandingState(MissionObject target)
 {
     _target = target;
     MissionStateText = "Land";
 }
Пример #32
0
 private void Start()
 {
     missionObject = GetComponent<MissionObject>();
 }
Пример #33
0
    public TakeoffState(MissionObject target)
    {
        _target = target;

        MissionStateText = "Take off";
    }