public ObjectiveRequirementKillAggregate(MissionObjective owner)
     : base(owner)
 {
     RequirementType = RequirementType.KillAggregate;
     AllowedType = -1;
     ContinentId = -1;
 }
 public ObjectiveRequirementPatrol(MissionObjective owner)
     : base(owner)
 {
     RequirementType = RequirementType.Patrol;
     ContinentId = -1;
     Laps = 1;
     Sequential = true;
     GenericTargets = new Int64[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
 }
 static bool Prefix(MissionLevelDetailViewController __instance, MissionNode ____missionNode, LevelBar ____levelBar, ObjectiveListItemsList ____objectiveListItems, GameplayModifiersModelSO ____gameplayModifiersModel, GameObject ____modifiersPanelGO, GameplayModifierInfoListItemsList ____gameplayModifierInfoListItemsList)
 {
     if (____missionNode.missionData is CustomMissionDataSO)
     {
         CustomMissionDataSO       missionData = (____missionNode.missionData as CustomMissionDataSO);
         CustomPreviewBeatmapLevel level       = missionData.customLevel;
         if (level == null)
         {
             // TODO: Localization?
             ____levelBar.GetPrivateField <TextMeshProUGUI>("_songNameText").text   = "SONG NOT FOUND";
             ____levelBar.GetPrivateField <TextMeshProUGUI>("_difficultyText").text = "SONG NOT FOUND";
             ____levelBar.GetPrivateField <TextMeshProUGUI>("_authorNameText").text = "SONG NOT FOUND";
         }
         else
         {
             ____levelBar.Setup(level, missionData.beatmapCharacteristic, missionData.beatmapDifficulty);
         }
         MissionObjective[] missionObjectives = missionData.missionObjectives;
         ____objectiveListItems.SetData((missionObjectives.Length == 0) ? 1 : missionObjectives.Length, delegate(int idx, ObjectiveListItem objectiveListItem)
         {
             if (idx == 0 && missionObjectives.Length == 0)
             {
                 objectiveListItem.title         = Localization.Get("CAMPAIGN_FINISH_LEVEL");
                 objectiveListItem.conditionText = "";
                 objectiveListItem.hideCondition = true;
             }
             else
             {
                 MissionObjective missionObjective = missionObjectives[idx];
                 if (missionObjective.type.noConditionValue)
                 {
                     objectiveListItem.title         = missionObjective.type.objectiveNameLocalized.Replace(" ", "\n");
                     objectiveListItem.hideCondition = true;
                 }
                 else
                 {
                     objectiveListItem.title         = missionObjective.type.objectiveNameLocalized;
                     objectiveListItem.hideCondition = false;
                     ObjectiveValueFormatterSO objectiveValueFormater = missionObjective.type.objectiveValueFormater;
                     objectiveListItem.conditionText = $"{MissionDataExtensions.Name(missionObjective.referenceValueComparisonType)} {objectiveValueFormater.FormatValue(missionObjective.referenceValue)}";
                 }
             }
         });
         List <GameplayModifierParamsSO> modifierParamsList = ____gameplayModifiersModel.GetModifierParams(missionData.gameplayModifiers);
         ____modifiersPanelGO.SetActive(modifierParamsList.Count > 0);
         ____gameplayModifierInfoListItemsList.SetData(modifierParamsList.Count, delegate(int idx, GameplayModifierInfoListItem gameplayModifierInfoListItem)
         {
             GameplayModifierParamsSO gameplayModifierParamsSO = modifierParamsList[idx];
             gameplayModifierInfoListItem.modifierIcon         = gameplayModifierParamsSO.icon;
             gameplayModifierInfoListItem.hoverHintText        = Localization.Get(gameplayModifierParamsSO.modifierNameLocalizationKey) + " - " + Localization.Get(gameplayModifierParamsSO.descriptionLocalizationKey);
         });
         return(false);
     }
     return(true);
 }
 public ObjectiveRequirementKill(MissionObjective owner)
     : base(owner)
 {
     RequirementType = RequirementType.Kill;
     TargetCBID = -1;
     ContinentId = -1;
     AllowedType = -1;
     AllowedClass = -1;
     MinLevel = -1;
     MaxLevel = -1;
 }
 public ObjectiveRequirementEscort(MissionObjective owner)
     : base(owner)
 {
     RequirementType = RequirementType.Escort;
     StartEscort = true;
     EndEscort = true;
     ContinentId = -1;
     CompletionPatrol = -1L;
     FailPatrol = -1L;
     CachedCreatureId = -1;
 }
Example #6
0
 private void OnObjectiveFailed(MissionObjective objective)
 {
     if (objective.objectiveType == MissionObjective.ObjectiveType.PRIMARY)
     {
         onMissionFailed?.Invoke();
     }
     else
     {
         //Else just go to the next object
         GoToNextObjective();
     }
 }
 public ObjectiveRequirementUseItem(MissionObjective owner)
     : base(owner)
 {
     RequirementType = RequirementType.UseItem;
     PrimaryItem = -1L;
     PrimaryCBID = -1;
     PrimaryCompletedItem = -1;
     SecondaryCBID = -1;
     CompletedItem = -1;
     CompletedMission = -1;
     RepeatCount = 1;
     ContinentID = -1;
 }
Example #8
0
        private List <MissionObjective> DeserializeObjectives(DataSerializer s)
        {
            int objectiveCount = s.ReadInt16();
            List <MissionObjective> objectives = new List <MissionObjective>(objectiveCount);

            for (int i = 0; i < objectiveCount; ++i)
            {
                MissionObjective objective = new MissionObjective();
                objective.Deserialize(s);
            }

            return(objectives);
        }
        public MissionObjective GetAsMissionObjective()
        {
            MissionObjective       objective = new MissionObjective();
            MissionObjectiveTypeSO missionObjectiveTypeSO = ScriptableObject.CreateInstance <MissionObjectiveTypeSO>();

            missionObjectiveTypeSO.SetPrivateField("_objectiveName", GetObjectiveName(type));
            missionObjectiveTypeSO.SetPrivateField("_noConditionValue", GetNoCondition(type));
            missionObjectiveTypeSO.SetPrivateField("_objectiveValueFormater", GetObjectiveValueFormater(type));
            objective.SetPrivateField("_type", missionObjectiveTypeSO);
            objective.SetPrivateField("_referenceValueComparisonType", isMax ? ReferenceValueComparisonType.Max : ReferenceValueComparisonType.Min);
            objective.SetPrivateField("_referenceValue", count);
            return(objective);
        }
 public ObjectiveRequirementCollect(MissionObjective owner)
     : base(owner)
 {
     RequirementType = RequirementType.Collect;
     TargetCount = 0;
     ItemCBID = -1;
     ContinentId = -1;
     AllowedType = -1;
     AllowedClass = -1;
     MinLevel = -1;
     MaxLevel = -1;
     OptinonalTargets = new[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
 }
Example #11
0
    protected override void Awake()
    {
        //Init
        missionObjectivesList.ForEach(objective =>
        {
            objective.Init();
            objective.onObjectiveComplete      += OnObjectiveComplete;
            objective.onObjectiveFailed        += OnObjectiveFailed;
            objective.onObjectiveStatusChanged += OnObjectiveStatusChanged;
        });

        currentObjective = missionObjectivesList[0];
        currentObjective.SetObjectiveStatus(MissionObjective.ObjectiveStatus.INPROGRESS);
    }
        public ObjectiveRequirementDeliver(MissionObjective owner)
            : base(owner)
        {
            RequirementType = RequirementType.Deliver;

            GiveItemOnStart = true;
            TakeItemAtEnd = true;
            NPCTargetCompletes = true;
            RequireItemToComplete = true;

            ItemCBID = -1;
            NPCTargetCBID = -1;
            NPCContinentId = -1;
        }
Example #13
0
    void GoToNextObjective()
    {
        var index = missionObjectivesList.FindIndex(missionObjective => missionObjective == currentObjective);

        if (index + 1 < missionObjectivesList.Count)
        {
            index++;

            currentObjective = missionObjectivesList[index];
            currentObjective.SetObjectiveStatus(MissionObjective.ObjectiveStatus.INPROGRESS);
        }
        else
        {
            onMissionComplete?.Invoke();
        }
    }
    static bool Prefix(MissionObjective __instance)
    {
        Debug.Log("A mission got completed we need to send it");

        int hashCode = ObjectiveNetworker_Reciever.getMissionHash(__instance);

        Message_ObjectiveSync objOutMessage = new Message_ObjectiveSync(PlayerManager.localUID, hashCode, ObjSyncType.EMissionCompleted);

        if (Networker.isHost)
        {
            Debug.Log("Host sent objective complete " + __instance.objectiveID);
            ObjectiveNetworker_Reciever.completeNext = false;
            ObjectiveNetworker_Reciever.ObjectiveHistory.Add(objOutMessage);
            NetworkSenderThread.Instance.SendPacketAsHostToAllClients(objOutMessage, Steamworks.EP2PSend.k_EP2PSendReliable);
        }
        else
        {
            bool shouldComplete = ObjectiveNetworker_Reciever.completeNext;
            if (VTScenario.current.objectives.GetObjective(__instance.objectiveID).objectiveType == VTObjective.ObjectiveTypes.Fly_To ||
                VTScenario.current.objectives.GetObjective(__instance.objectiveID).objectiveType == VTObjective.ObjectiveTypes.Refuel ||
                VTScenario.current.objectives.GetObjective(__instance.objectiveID).objectiveType == VTObjective.ObjectiveTypes.Join ||
                VTScenario.current.objectives.GetObjective(__instance.objectiveID).objectiveType == VTObjective.ObjectiveTypes.Land)
            {
                if (shouldComplete == false)
                {
                    //we havent been told to do this by host send it.
                    NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, objOutMessage, Steamworks.EP2PSend.k_EP2PSendReliable);
                }
                return(true);
            }
            else
            {
                //    VTScenario.current.objectives.GetObjective(__instance.objectiveID).objectiveType == VTObjective.ObjectiveTypes.Conditional)


                Debug.Log($"Should complete is {shouldComplete}.");
                ObjectiveNetworker_Reciever.completeNext = false;
                return(shouldComplete);// clients should not send kill obj packets or have them complete
            }
            //NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, objOutMessage, Steamworks.EP2PSend.k_EP2PSendUnreliable);
        }
        return(true);
    }
    static bool Prefix(MissionObjective __instance)
    {
        //prevents infinite client host pings
        //if (__instance.completed)
        //   return false;
        Debug.Log("A mission got completed we need to send it");


        // Debug.Log("sending __instance.objectiveName + __instance.objectiveID");
        String actionIdentifier = __instance.objectiveName + __instance.objectiveID;

        Debug.Log(actionIdentifier);

        //dont run corrupt objectives
        if (MissionManager.instance.IndexOfObjective(__instance) == -1)
        {
            return(false);
        }
        Message_ObjectiveSync objOutMessage = new Message_ObjectiveSync(PlayerManager.localUID, MissionManager.instance.IndexOfObjective(__instance), ObjSyncType.EMissionCompleted);

        if (Networker.isHost && objOutMessage.objID != -1)
        {
            Debug.Log("Host sent objective complete " + __instance.objectiveID);
            ObjectiveNetworker_Reciever.completeNext = false;
            NetworkSenderThread.Instance.SendPacketAsHostToAllClients(objOutMessage, Steamworks.EP2PSend.k_EP2PSendReliable);
        }
        else
        {
            //if (VTScenario.current.objectives.GetObjective(__instance.objectiveID).objectiveType == VTObjective.ObjectiveTypes.Destroy ||
            //    VTScenario.current.objectives.GetObjective(__instance.objectiveID).objectiveType == VTObjective.ObjectiveTypes.Conditional)

            bool shouldComplete = ObjectiveNetworker_Reciever.completeNext;
            Debug.Log($"Should complete is {shouldComplete}.");
            ObjectiveNetworker_Reciever.completeNext = false;
            return(shouldComplete);   // clients should not send kill obj packets or have them complete

            //NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, objOutMessage, Steamworks.EP2PSend.k_EP2PSendUnreliable);
        }
        return(true);
    }
        private void UpdateMissionTick()
        {
            float simulationTime = TimeHelper.ToSystemTime(m_managers.threading);

            foreach (Mission mission in MissionList)
            {
                if (mission.MissionState == Mission.State.Started)
                {
                    MissionTemplate missionObjectiveTemplate =
                        MissionTemplateDatabase.Instance.GetTemplate(mission.TemplateId);
                    int objectiveCount = missionObjectiveTemplate.MissionObjectiveTempates.Count;
                    for (int i = 0; i < objectiveCount; ++i)
                    {
                        MissionObjectiveTemplate objectiveTemplate = missionObjectiveTemplate.MissionObjectiveTempates[i];
                        MissionObjective         objective         = mission.Objectives[i];
                        int passedCount = 0;
                        foreach (MissionObjectiveRule rule in objectiveTemplate.Rules)
                        {
                            MissionObjectiveRule.RuleEvaluationResult result = rule.EvaluateMissionObjectiveRule(objective, m_managers);
                            if (result == MissionObjectiveRule.RuleEvaluationResult.Failed)
                            {
                                objective.Fail(simulationTime);
                                break;
                            }
                            else if (result == MissionObjectiveRule.RuleEvaluationResult.Passed)
                            {
                                passedCount++;
                            }
                        }

                        if (passedCount == objectiveTemplate.Rules.Count)
                        {
                            objective.Complete(simulationTime);
                        }
                    }
                }
            }
        }
Example #17
0
    void ObjectiveProgressed(Mission mission, MissionObjective objective, string target = "")
    {
        /*	To be called when an enemy has been killed or objective otherwise completed.
         * Target is given default parameter of "" incase we're not checking an objective
         * with a target string.
         */
        if (objective.objectiveType == ObjectiveType.KillXShip)
        {
            objective.targetQuantity--;
        }
        else
        {
            objective.completed = true;
        }

        if (objective.targetQuantity == 0 || objective.targetNameMatches(target))
        {
            _guiBehaviour.ReceiveMessage("COMPLETE: " + objective.description, true);
            _statsMenu.MissionListChanged();
            objective.completed = true;
            CheckMissionFinished(mission);
        }
    }
    static bool Prefix(MissionObjective __instance)
    {
        Debug.Log("A mission got failed we need to send it");

        int hashCode = ObjectiveNetworker_Reciever.getMissionHash(__instance);

        Message_ObjectiveSync objOutMessage = new Message_ObjectiveSync(PlayerManager.localUID, hashCode, ObjSyncType.EMissionFailed);

        if (Networker.isHost)
        {
            Debug.Log("Host sent objective fail " + __instance.objectiveID);
            ObjectiveNetworker_Reciever.ObjectiveHistory.Add(objOutMessage);
            NetworkSenderThread.Instance.SendPacketAsHostToAllClients(objOutMessage, Steamworks.EP2PSend.k_EP2PSendReliable);
        }
        else
        {
            bool shouldComplete = ObjectiveNetworker_Reciever.completeNextFailed;
            Debug.Log($"Should complete is {shouldComplete}.");
            ObjectiveNetworker_Reciever.completeNextFailed = false;
            return(shouldComplete);// clients should not send kill obj packets or have them complete
            //NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, objOutMessage, Steamworks.EP2PSend.k_EP2PSendUnreliable);
        }
        return(true);
    }
Example #19
0
 private float ElapsedMissionObjectiveTime(MissionObjective objective, DateTime simulationTime)
 {
     return(simulationTime.Ticks - objective.StartedTimestamp);
 }
Example #20
0
 public override RuleEvaluationResult EvaluateMissionObjectiveRule(MissionObjective objective, IManagers managers)
 {
     return(ElapsedMissionObjectiveTime(objective, managers.threading.simulationTime) >= m_timeoutDuration ? RuleEvaluationResult.Failed :  RuleEvaluationResult.Passed);
 }
 public ObjectiveRequirementKm(MissionObjective owner)
     : base(owner)
 {
     RequirementType = RequirementType.Km;
 }
        public static ObjectiveRequirement Create(MissionObjective owner, XElement elem)
        {
            var type = (String)elem.Attribute("type");

            ObjectiveRequirement req;

            switch (type)
            {
                case "kill":
                    req = new ObjectiveRequirementKill(owner);
                    break;

                case "kill_aggregate":
                    req = new ObjectiveRequirementKillAggregate(owner);
                    break;

                case "collect":
                    req = new ObjectiveRequirementCollect(owner);
                    break;

                case "deliver":
                    req = new ObjectiveRequirementDeliver(owner);
                    break;

                case "money":
                    req = new ObjectiveRequirementMoney(owner);
                    break;

                case "stunt":
                    req = new ObjectiveRequirementStunt(owner);
                    break;

                case "mission":
                    req = new ObjectiveRequirementMission(owner);
                    break;

                case "km":
                    req = new ObjectiveRequirementKm(owner);
                    break;

                case "timeplayed":
                    req = new ObjectiveRequirementTimePlayed(owner);
                    break;

                case "patrol":
                    req = new ObjectiveRequirementPatrol(owner);
                    break;

                case "useitem":
                    req = new ObjectiveRequirementUseItem(owner);
                    break;

                case "characterlevel":
                    req = new ObjectiveRequirementCharacterLevel(owner);
                    break;

                case "escort":
                    req = new ObjectiveRequirementEscort(owner);
                    break;

                case "crazytaxi":
                    req = new ObjectiveRequirementCrazyTaxi(owner);
                    break;

                default:
                    return null;
            }

            req.UnSerialize(elem);

            return req;
        }
    public static void objectiveUpdate(int id, ObjSyncType status)
    {
        Debug.Log($"Doing objective update for id {id}.");
        if (mManager == null)
        {
            mManager = MissionManager.instance;
            if (mManager == null)
            {
                Debug.Log("MissionManager manager Null");
                return;
            }
        }
        if (id == -1)
        {
            Debug.Log("Got a -1 ID, not doing it.");
            return;
        }
        MissionObjective obj = mManager.GetObjective(id);

        if (obj == null)
        {
            Debug.Log("obj was Null");
            return;
        }


        if (status == ObjSyncType.EMissionCompleted && !obj.completed)
        {
            Debug.Log("Completeing mission complete locally");
            completeNext = true;
            if (!obj.started)
            {
                obj.BeginMission();
            }
            obj.CompleteObjective();
        }

        if (status == ObjSyncType.EMissionFailed && !obj.failed)
        {
            Debug.Log("failing mission complete locally");
            completeNextFailed = true;
            if (!obj.started)
            {
                obj.BeginMission();
            }
            obj.FailObjective();
        }

        if (status == ObjSyncType.EMissionBegin && !obj.started)
        {
            Debug.Log("starting mission begin locally");
            completeNextBegin = true;
            obj.BeginMission();
        }

        if (status == ObjSyncType.EMissionCanceled && !obj.cancelled)
        {
            Debug.Log("starting mission cancel locally");
            completeNextCancel = true;
            if (!obj.started)
            {
                obj.BeginMission();
            }
            obj.CancelObjective();
        }
    }
Example #24
0
 private void OnObjectiveComplete(MissionObjective objective)
 {
     GoToNextObjective();
 }
 public ObjectiveRequirementCrazyTaxi(MissionObjective owner)
     : base(owner)
 {
     RequirementType = RequirementType.CrazyTaxi;
     ContinentId = -1;
 }
Example #26
0
 public void objectiveBegin(MissionObjective obj)
 {
     dataLog.Append("\n" + $"0,Event=Bookmark|Objective '{obj.objectiveName}' Started");
 }
Example #27
0
    private void GetMouseInput(float a_deltaTime)
    {
        if (Time.timeSinceLevelLoad < 0.5f)
        {
            return;
        }
        bool    flag          = !this.m_inventory.IsVisible() && !this.m_communicator.IsActive(true) && false == this.m_popupGui.IsActive();
        Vector3 mousePosition = Input.mousePosition;
        bool    flag2         = (this.m_lastMousePos - mousePosition).sqrMagnitude > 4f;

        this.m_lastMousePos = mousePosition;
        Ray ray = Camera.main.ScreenPointToRay(mousePosition);

        if (flag2)
        {
            this.m_hideCursorTime = Time.time + 1f;
        }
        bool flag3 = Time.time < this.m_hideCursorTime;

        if (flag3 != Screen.showCursor)
        {
            Screen.showCursor = flag3;
        }
        if (Input.GetMouseButton(1) && flag)
        {
            this.m_buildRot += a_deltaTime * 90f;
            while (this.m_buildRot > 360f)
            {
                this.m_buildRot -= 360f;
            }
        }
        if (Input.GetMouseButtonDown(1))
        {
            RaycastHit raycastHit;
            if (Physics.Raycast(ray, out raycastHit, 100f, 665600))
            {
                int layer = raycastHit.transform.gameObject.layer;
                if (layer != 13)
                {
                    if (layer == 17)
                    {
                        if (!this.m_inventory.IsShopActive())
                        {
                            RemoteItem component = raycastHit.transform.GetComponent <RemoteItem>();
                            if (null != component && this.m_inventory.IsVisible())
                            {
                                this.m_itemGui.Show(component, ray.GetPoint(4.5f));
                            }
                        }
                    }
                }
                else if (flag)
                {
                    RemoteCharacter component2 = raycastHit.transform.GetComponent <RemoteCharacter>();
                    if (null != component2 && null != this.m_client)
                    {
                        ulong steamId = this.m_client.GetSteamId(component2.m_id);
                        if (Global.isSteamActive && 0UL < steamId)
                        {
                            SteamFriends.ActivateGameOverlayToUser("steamid", new CSteamID(steamId));
                        }
                    }
                }
            }
        }
        else if (Input.GetMouseButtonDown(0))
        {
            if (flag)
            {
                this.ResetTarget();
            }
            bool       flag4 = false;
            RaycastHit raycastHit2;
            if (Physics.Raycast(ray, out raycastHit2, 100f, 6995488))
            {
                switch (raycastHit2.transform.gameObject.layer)
                {
                case 9:
                case 13:
                    if (flag)
                    {
                        RemoteCharacter component3 = raycastHit2.transform.GetComponent <RemoteCharacter>();
                        if (null != component3)
                        {
                            if (!component3.m_isOwnPlayer)
                            {
                                this.m_currentTarget = component3;
                                flag4 = true;
                            }
                        }
                        else if (flag && Input.GetAxis("Vertical") == 0f && Input.GetAxis("Horizontal") == 0f)
                        {
                            this.CalculatePath(raycastHit2.point, 12 != raycastHit2.transform.gameObject.layer);
                        }
                    }
                    break;

                case 10:
                case 12:
                case 21:
                    if (flag && Input.GetAxis("Vertical") == 0f && Input.GetAxis("Horizontal") == 0f && null != this.m_client && !this.m_client.IsInVehicle())
                    {
                        Vector3 point = raycastHit2.point;
                        this.m_walkIndicator.position = new Vector3(raycastHit2.point.x, 0.1f, raycastHit2.point.z);
                        this.CalculatePath(point, 12 != raycastHit2.transform.gameObject.layer);
                    }
                    break;

                case 11:
                case 15:
                case 19:
                case 22:
                    flag4 = flag;
                    break;

                case 17:
                    if (this.m_inventory.IsShopActive())
                    {
                        RemoteItem component4 = raycastHit2.transform.GetComponent <RemoteItem>();
                        if (null != component4 && component4.m_type != 254 && this.m_inventory.IsVisible())
                        {
                            this.m_buySellPos = this.m_inventory.ToWorldPos(component4.transform.localPosition);
                            bool    flag5   = this.m_buySellPos.x < 6f;
                            float   num     = (!flag5) ? this.m_inventory.GetShopBuyMultiplier() : this.m_inventory.GetShopSellMultiplier();
                            string  text    = (!flag5) ? LNG.Get("BUY") : LNG.Get("SELL");
                            int     num2    = (int)(Items.GetValue(component4.m_type, component4.m_amountOrCond) * num + 0.5f);
                            string  text2   = (!Items.HasCondition(component4.m_type)) ? ("x " + component4.m_amountOrCond) : (component4.m_amountOrCond.ToString() + "%");
                            ItemDef itemDef = Items.GetItemDef(component4.m_type);
                            if (flag5 || this.m_client.GetGoldCount() >= num2)
                            {
                                string a_caption = string.Concat(new object[]
                                {
                                    text,
                                    "\n",
                                    LNG.Get(itemDef.ident),
                                    "\n",
                                    text2,
                                    "\nfor ",
                                    num2,
                                    " ",
                                    LNG.Get("CURRENCY"),
                                    "?"
                                });
                                this.m_buySellPopupSessionId = this.m_popupGui.ShowGui(true, a_caption);
                            }
                            else
                            {
                                string a_caption2 = string.Concat(new object[]
                                {
                                    LNG.Get("ITEMSHOP_TOO_LESS_GOLD"),
                                    "\n",
                                    num2,
                                    " ",
                                    LNG.Get("CURRENCY")
                                });
                                this.m_popupGui.ShowGui(true, a_caption2);
                            }
                        }
                    }
                    else if (Time.time < this.m_doubleClickTime)
                    {
                        this.m_doubleClickTime = 0f;
                        if (null != raycastHit2.transform)
                        {
                            Vector3 localPosition = raycastHit2.transform.localPosition;
                            Vector3 zero          = Vector3.zero;
                            if (this.m_inventory.DragDrop(ref localPosition, ref zero))
                            {
                                this.m_sendDragPos = localPosition;
                                this.m_sendDropPos = Vector3.zero;
                            }
                        }
                    }
                    else
                    {
                        this.m_dragItem     = raycastHit2.transform;
                        this.m_startDragPos = this.m_dragItem.localPosition;
                    }
                    break;
                }
            }
            if (flag4)
            {
                this.CalculateRotTowardsMouse(mousePosition);
                this.m_stopAttackingTime = Time.time + 0.3f;
            }
        }
        else if (Input.GetMouseButtonUp(0) && null != this.m_dragItem)
        {
            Vector3 startDragPos   = this.m_startDragPos;
            Vector3 localPosition2 = this.m_dragItem.localPosition;
            if (this.m_inventory.DragDrop(ref startDragPos, ref localPosition2))
            {
                if (startDragPos != localPosition2)
                {
                    this.m_sendDragPos = startDragPos;
                    this.m_sendDropPos = localPosition2;
                }
                else
                {
                    this.m_dragItem.localPosition = this.m_startDragPos;
                    this.m_doubleClickTime        = Time.time + 0.5f;
                }
            }
            this.m_dragItem = null;
        }
        if (null != this.m_dragItem)
        {
            this.m_dragItem.position = ray.GetPoint(5f);
            Vector3 localPosition3 = this.m_dragItem.localPosition;
            localPosition3.z = 0f;
            this.m_dragItem.localPosition = localPosition3;
        }
        else if (!flag2)
        {
            if (this.m_mouseOverDur != -1f)
            {
                this.m_mouseOverDur += a_deltaTime;
                if (this.m_mouseOverDur > 0.1f)
                {
                    this.m_buildingHealthIndicator.position = Vector3.up * 1000f;
                    this.m_tooltip.position     = Vector3.up * 1000f;
                    this.m_tooltipHudR.position = Vector3.up * 1000f;
                    this.m_tooltipHudR.parent   = null;
                    this.m_tooltipHudL.position = Vector3.up * 1000f;
                    this.m_tooltipHudL.parent   = null;
                    if (this.m_mouseOverRenderers != null && this.m_mouseOverRenderers.Length != 0)
                    {
                        foreach (Renderer renderer in this.m_mouseOverRenderers)
                        {
                            if (null != renderer)
                            {
                                renderer.gameObject.layer = this.m_mouseOverLayer;
                            }
                        }
                        this.m_mouseOverRenderers = null;
                    }
                    if (null != this.m_mouseOverTransform)
                    {
                        this.m_mouseOverTransform.localScale = this.m_initialMouseOverScale;
                        this.m_mouseOverTransform            = null;
                    }
                    RaycastHit raycastHit3;
                    if (Physics.Raycast(ray, out raycastHit3, 100f, 7007776))
                    {
                        if (raycastHit3.transform.gameObject.layer == 5)
                        {
                            string[] array = raycastHit3.transform.gameObject.name.Split(new char[]
                            {
                                '-'
                            });
                            if (array != null && 1 < array.Length)
                            {
                                if ("tooltip" == array[0])
                                {
                                    this.m_tooltipHudRText.text = LNG.Get(array[1]);
                                    this.m_tooltipHudR.position = raycastHit3.transform.position - raycastHit3.transform.right * 0.3f;
                                    this.m_tooltipHudR.rotation = raycastHit3.transform.rotation;
                                    this.m_tooltipHudR.parent   = raycastHit3.transform;
                                }
                                else if ("mission" == array[0])
                                {
                                    int a_index = 0;
                                    try
                                    {
                                        a_index = int.Parse(array[1]);
                                    }
                                    catch (Exception ex)
                                    {
                                        Debug.LogWarning("ClientInput.cs: " + ex.ToString());
                                    }
                                    Mission mission = this.m_client.GetMission(a_index);
                                    if (mission != null)
                                    {
                                        this.m_tooltipHudLText.text = string.Concat(new object[]
                                        {
                                            this.GetMissionText(mission),
                                            LNG.Get("TIME_LEFT"),
                                            ": ",
                                            (int)(mission.m_dieTime / 60f),
                                            " min"
                                        });
                                        this.m_tooltipHudL.position = raycastHit3.transform.position + raycastHit3.transform.right * 0.3f;
                                        this.m_tooltipHudL.rotation = raycastHit3.transform.rotation;
                                        this.m_tooltipHudL.parent   = raycastHit3.transform;
                                    }
                                }
                            }
                        }
                        else
                        {
                            this.m_mouseOverTransform    = raycastHit3.transform;
                            this.m_initialMouseOverScale = this.m_mouseOverTransform.localScale;
                            if (raycastHit3.transform.gameObject.layer == 17)
                            {
                                if (this.m_inventory.IsVisible())
                                {
                                    this.m_inventory.ShowInfo(raycastHit3.transform.position);
                                }
                            }
                            else if (raycastHit3.transform.gameObject.layer == 10)
                            {
                                this.m_mouseOverTransform.localScale *= 1.33f;
                            }
                            else if (raycastHit3.transform.gameObject.layer == 19)
                            {
                                RemoteBuilding component5 = raycastHit3.transform.parent.GetComponent <RemoteBuilding>();
                                if (null != this.m_buildingHealthIndicator && null != component5)
                                {
                                    Vector3 b = Vector3.up * 4f;
                                    float   x = 0.25f * (float)(3 - (int)(component5.m_health * 0.033f));
                                    this.m_buildingHealthIndicator.renderer.material.mainTextureOffset = new Vector2(x, 0f);
                                    this.m_buildingHealthIndicator.position = raycastHit3.transform.position + b;
                                }
                            }
                            else if (raycastHit3.transform.gameObject.layer == 15)
                            {
                                bool    flag6 = "building_10" == raycastHit3.transform.gameObject.name || "building_11" == raycastHit3.transform.gameObject.name;
                                Vector3 b2    = Vector3.up * ((!flag6) ? 3f : 6.5f);
                                this.m_tooltipText.text = LNG.Get("TOOLTIP_RESOURCE");
                                this.m_tooltip.position = raycastHit3.transform.position + b2;
                            }
                            else if (raycastHit3.transform.gameObject.layer == 21)
                            {
                                Vector3 b3 = Vector3.up * 2f;
                                this.m_tooltipText.text = LNG.Get("TOOLTIP_ITEMSTORAGE");
                                this.m_tooltip.position = raycastHit3.transform.position + b3;
                            }
                            else if (raycastHit3.transform.gameObject.layer == 9)
                            {
                                RemoteCharacter component6 = raycastHit3.transform.GetComponent <RemoteCharacter>();
                                if (null == component6)
                                {
                                    Vector3 b4 = Vector3.up * 3f;
                                    this.m_tooltipText.text = LNG.Get("TOOLTIP_INTERACT");
                                    this.m_tooltip.position = raycastHit3.transform.position + b4;
                                }
                            }
                            else if (raycastHit3.transform.gameObject.layer == 22)
                            {
                                MissionObjective component7 = raycastHit3.transform.GetComponent <MissionObjective>();
                                if (null != component7)
                                {
                                    Vector3 b5 = Vector3.up * 3f;
                                    this.m_tooltipText.text = LNG.Get("MISSION_TYPE_" + component7.m_type.ToString("d"));
                                    this.m_tooltip.position = raycastHit3.transform.position + b5;
                                }
                            }
                            this.m_mouseOverRenderers = raycastHit3.transform.GetComponentsInChildren <Renderer>();
                            if (this.m_mouseOverRenderers.Length == 0 && null != raycastHit3.transform.parent)
                            {
                                this.m_mouseOverRenderers = raycastHit3.transform.parent.GetComponentsInChildren <Renderer>();
                            }
                            if (this.m_mouseOverRenderers.Length != 0)
                            {
                                this.m_mouseOverLayer = this.m_mouseOverRenderers[0].gameObject.layer;
                                foreach (Renderer renderer2 in this.m_mouseOverRenderers)
                                {
                                    renderer2.gameObject.layer = 20;
                                }
                            }
                        }
                    }
                    this.m_mouseOverDur = -1f;
                }
            }
        }
        else
        {
            this.m_mouseOverDur = 0f;
        }
    }
 public ObjectiveRequirementMission(MissionObjective owner)
     : base(owner)
 {
     RequirementType = RequirementType.Mission;
     MissionIds = new List<Int32>();
 }
Example #29
0
 public MissionTarget(IEntity target, MissionObjective objective)
 {
     this.Target = target;
     this.Objective = objective;
     complete = false;
 }
Example #30
0
 private void Awake()
 {
     _ui = FindObjectOfType <UIViewer>();
     _missionObjective = GetComponent <MissionObjective>();
 }
 public ObjectiveRequirementMoney(MissionObjective owner)
     : base(owner)
 {
     RequirementType = RequirementType.Money;
 }
 public ObjectiveRequirementTimePlayed(MissionObjective owner)
     : base(owner)
 {
     RequirementType = RequirementType.TimePlayed;
 }
Example #33
0
 public void objectiveComplete(MissionObjective obj)
 {
     dataLog.Append("\n" + $"0,Event=Bookmark|Objective '{obj.objectiveName}' Completed");
 }
    public static void objectiveUpdate(int hashCode, ObjSyncType status)
    {
        Debug.Log($"Doing objective update for id {hashCode}.");

        if (status == ObjSyncType.EVTBegin)
        {
            //VTScenario.current.objectives.GetObjective(hashCode).Dispose();
            VTScenario.current.objectives.GetObjective(hashCode).BeginObjective();
        }

        if (!objectiveHashTable.ContainsKey(hashCode))
        {
            loadObjectives();
        }

        if (!objectiveHashTable.ContainsKey(hashCode))
        {
            Debug.Log("cant find objective in hashTable");
            return;
        }


        MissionObjective obj = objectiveHashTable[hashCode];

        if (obj == null)
        {
            Debug.Log("obj was Null");
            return;
        }


        if (status == ObjSyncType.EMissionCompleted && !obj.completed)
        {
            Debug.Log("Completeing mission complete locally");
            completeNext = true;
            if (!obj.started)
            {
                obj.BeginMission();
            }
            obj.CompleteObjective();
            loadObjectives();
        }

        if (status == ObjSyncType.EMissionFailed && !obj.failed)
        {
            Debug.Log("failing mission complete locally");
            completeNextFailed = true;
            if (!obj.started)
            {
                obj.BeginMission();
            }

            obj.FailObjective();
            loadObjectives();
        }

        if (status == ObjSyncType.EMissionBegin && !obj.started)
        {
            Debug.Log("starting mission begin locally");
            completeNextBegin = true;
            obj.BeginMission();
            loadObjectives();
        }

        if (status == ObjSyncType.EMissionCanceled && !obj.cancelled)
        {
            Debug.Log("starting mission cancel locally");
            completeNextCancel = true;
            if (!obj.started)
            {
                obj.BeginMission();
            }
            obj.CancelObjective();
            loadObjectives();
        }
    }
Example #35
0
 public void objectiveFail(MissionObjective obj)
 {
     dataLog.Append("\n" + $"0,Event=Bookmark|Objective '{obj.objectiveName}' Failed");
 }
Example #36
0
 private void OnObjectiveStatusChanged(MissionObjective objective)
 {
 }
 void PickUpMissionObjective(MissionObjective objective)
 {
     playerInventory.AddObjectibeTags(objective.GetTag());
     objective.DestroyObject();
     CollisionInteraction?.Invoke(null);
 }
 private void ProcessObjectiveStatusChanged(MissionObjective objective)
 {
     print("Changes don happen");
     Refresh();
 }
 public ObjectiveRequirementStunt(MissionObjective owner)
     : base(owner)
 {
     RequirementType = RequirementType.Stunt;
 }
 public ObjectiveRequirementCharacterLevel(MissionObjective owner)
     : base(owner)
 {
     RequirementType = RequirementType.CharacterLevel;
     PreviousLevel = -1;
 }
 protected ObjectiveRequirement(MissionObjective owner)
 {
     ObjectiveOwner = owner;
 }