public ShipArchetype(Section sec) : base(sec)
        {
            Setting tmpSet;

            if (sec.TryGetFirstOf("steering_torque", out tmpSet))
            {
                SteeringTorque = new JVector(float.Parse(tmpSet[0]), float.Parse(tmpSet[1]), float.Parse(tmpSet[2]));
            }

            if (sec.TryGetFirstOf("angular_drag", out tmpSet))
            {
                AngularDrag = new JVector(float.Parse(tmpSet[0]), float.Parse(tmpSet[1]), float.Parse(tmpSet[2]));
            }

            if (sec.TryGetFirstOf("rotation_inertia", out tmpSet))
            {
                RotationInertia = new JVector(float.Parse(tmpSet[0]), float.Parse(tmpSet[1]), float.Parse(tmpSet[2]));
            }

            if (sec.TryGetFirstOf("nudge_force", out tmpSet))
            {
                NudgeForce = float.Parse(tmpSet[0]);
            }

            if (sec.TryGetFirstOf("linear_drag", out tmpSet))
            {
                LinearDrag = float.Parse(tmpSet[0]);
            }

            if (sec.TryGetFirstOf("hold_size", out tmpSet))
            {
                HoldSize = float.Parse(tmpSet[0]);
            }

            if (sec.TryGetFirstOf("strafe_force", out tmpSet))
            {
                StrafeForce = float.Parse(tmpSet[0]);
            }

            if (sec.TryGetFirstOf("nanobot_limit", out tmpSet))
            {
                NanobotLimit = uint.Parse(tmpSet[0]);
            }

            if (sec.TryGetFirstOf("shield_battery_limit", out tmpSet))
            {
                ShieldBatteryLimit = uint.Parse(tmpSet[0]);
            }

            if (sec.TryGetFirstOf("mission_property", out tmpSet))
            {
                mission_property = (MissionProperty)
                                   Enum.Parse(typeof(MissionProperty),
                                              tmpSet[0].ToUpperInvariant());
            }
        }
    void OnMissionResume(int mission_id)
    {
        MissionProperty mp      = PeCustomScene.Self.scenario.missionMgr.GetMissionProperty(mission_id);
        bool            tracked = PeCustomScene.Self.scenario.missionMgr.MissionIsTracked(mission_id);


        if (mp != null && tracked)
        {
            if (mp.type != MissionProperty.EType.Hidden && !m_TrackedIds.Contains(mission_id))
            {
                m_TrackedIds.Add(mission_id);
                missionTrackWnd.AddViewNode();
            }
        }
    }
示例#3
0
 public ShipArchetype(string datapath, FLDataFile.Section sec, ILogController log)
     : base(datapath, sec, log)
 {
     if (sec.SettingExists("steering_torque"))
     {
         SteeringTorque = sec.GetSetting("steering_torque").Vector();
     }
     if (sec.SettingExists("angular_drag"))
     {
         AngularDrag = sec.GetSetting("angular_drag").Vector();
     }
     if (sec.SettingExists("rotation_inertia"))
     {
         RotationInertia = sec.GetSetting("rotation_inertia").Vector();
     }
     if (sec.SettingExists("nudge_force"))
     {
         NudgeForce = sec.GetSetting("nudge_force").Float(0);
     }
     if (sec.SettingExists("linear_drag"))
     {
         LinearDrag = sec.GetSetting("linear_drag").Float(0);
     }
     if (sec.SettingExists("hold_size"))
     {
         HoldSize = sec.GetSetting("hold_size").Float(0);
     }
     if (sec.SettingExists("strafe_force"))
     {
         StrafeForce = sec.GetSetting("strafe_force").Float(0);
     }
     if (sec.SettingExists("nanobot_limit"))
     {
         NanobotLimit = sec.GetSetting("nanobot_limit").UInt(0);
     }
     if (sec.SettingExists("shield_battery_limit"))
     {
         ShieldBatteryLimit = sec.GetSetting("shield_battery_limit").UInt(0);
     }
     if (sec.SettingExists("mission_property"))
     {
         mission_property =
             (MissionProperty)
             Enum.Parse(typeof(MissionProperty),
                        sec.GetSetting("mission_property").Str(0).ToUpperInvariant());
     }
 }
    void OnRunMission(int id)
    {
        MissionProperty mp = PeCustomScene.Self.scenario.missionMgr.GetMissionProperty(id);

        if (mp != null)
        {
            if (mp.type == MissionProperty.EType.MainStory)
            {
                m_MainStoryIds.Add(id);
                missionWnd.AddMainStoryNode();
            }
            else if (mp.type == MissionProperty.EType.SideQuest)
            {
                m_SideQuestIdes.Add(id);
                missionWnd.AddSideQuestNode();
            }
        }
    }
    void OnViewNodeSetContent(UIMissionGoalNode node)
    {
        MissionProperty mp = PeCustomScene.Self.scenario.missionMgr.GetMissionProperty(m_TrackedIds[node.index]);

        node.SetContent("[C8C800]" + mp.name + "[-]", false, false);

        node.onSetChildNodeContent += OnSetViewNodeChildContent;

        SortedList <int, MissionGoal> goals = PeCustomScene.Self.scenario.missionMgr.GetGoals(m_TrackedIds[node.index]);

        if (goals != null)
        {
            _goals = goals.Values;

            node.UpdateChildNode(_goals.Count, missionTrackWnd.childNodePrefab);
            node.PlayTween(true);
        }
        else
        {
            node.UpdateChildNode(0, missionTrackWnd.childNodePrefab);
        }
    }
    void OnMissionDeleteClick(UIMissionGoalNode node)
    {
        //MessageBox_N.ShowYNBox("Sure to")

        _deleteMissionId = -1;
        // Main Stroy
        if (missionWnd.MissionType == 0)
        {
            _deleteMissionId = m_MainStoryIds[node.index];
        }
        else if (missionWnd.MissionType == 1)
        {
            _deleteMissionId = m_SideQuestIdes[node.index];
        }

        if (_deleteMissionId != -1)
        {
            MissionProperty mp = PeCustomScene.Self.scenario.missionMgr.GetMissionProperty(_deleteMissionId);
            if (mp != null)
            {
                if (mp.canAbort)
                {
                    MessageBox_N.ShowYNBox(PELocalization.GetString(8000066), DeleteMissionOk);
                }
                else
                {
                    //lz-2016.10.31 The mission can't be aborted.
                    new PeTipMsg(PELocalization.GetString(8000850), PeTipMsg.EMsgLevel.Warning);
                }
            }
            else
            {
                Debug.LogError("Get the Deleted Mission property is error");
            }
        }
    }
    void OnSetNodeContent(int type, UIMissionGoalNode node)
    {
        // Main Story
        MissionProperty mp        = null;
        bool            can_track = false;

        if (type == 0)
        {
            mp        = PeCustomScene.Self.scenario.missionMgr.GetMissionProperty(m_MainStoryIds[node.index]);
            can_track = PeCustomScene.Self.scenario.missionMgr.MissionIsTracked(m_MainStoryIds[node.index]);
        }
        else if (type == 1)
        {
            mp        = PeCustomScene.Self.scenario.missionMgr.GetMissionProperty(m_SideQuestIdes[node.index]);
            can_track = PeCustomScene.Self.scenario.missionMgr.MissionIsTracked(m_SideQuestIdes[node.index]);
        }

        if (mp != null)
        {
            node.SetContent(mp.name, mp.canAbort, true);
            node.IsSelected = false;
            node.isTracked  = can_track;
        }
    }
    void OnMissionNodeClick(int type, UIMissionGoalNode node)
    {
        RefreshNodeSelected();

        DetachGoalEvent();

        MissionProperty mp = null;

        if (type == 0)
        {
            mp            = PeCustomScene.Self.scenario.missionMgr.GetMissionProperty(m_MainStoryIds[node.index]);
            _currentGoals = PeCustomScene.Self.scenario.missionMgr.GetGoals(m_MainStoryIds[node.index]);
            if (_currentGoals != null)
            {
                _goals = _currentGoals.Values;
            }

            _currentMissionId = m_MainStoryIds[node.index];
        }
        else if (type == 1)
        {
            mp            = PeCustomScene.Self.scenario.missionMgr.GetMissionProperty(m_SideQuestIdes[node.index]);
            _currentGoals = PeCustomScene.Self.scenario.missionMgr.GetGoals(m_SideQuestIdes[node.index]);
            if (_currentGoals != null)
            {
                _goals = _currentGoals.Values;
            }

            _currentMissionId = m_SideQuestIdes[node.index];
        }
        else
        {
            _currentMissionId = -1;
            _currentGoals     = null;
            _goals            = null;

            _rewardItemIds   = null;
            _rewardItemCount = null;
        }

        if (mp != null)
        {
            // Begin Npc
            if (CustomGameData.Mgr.Instance != null &&
                CustomGameData.Mgr.Instance.curGameData.WorldIndex == mp.beginNpcWorldIndex)
            {
                SpawnPoint sp = PeCustomScene.Self.spawnData.GetSpawnPoint(mp.beginNpcId);
                if (sp as NPCSpawnPoint != null)
                {
                    NpcProtoDb.Item proto = NpcProtoDb.Get(sp.Prototype);
                    missionWnd.SetMissionAbout(sp.Name, proto.iconBig, mp.objective);
                }
                else if (sp as MonsterSpawnPoint != null)
                {
                    MonsterProtoDb.Item proto_mst = MonsterProtoDb.Get(sp.Prototype);
                    missionWnd.SetMissionAbout(sp.Name, proto_mst.icon, mp.objective);
                }
                else
                {
                    missionWnd.SetMissionAbout("None", "npc_big_Unknown", mp.objective);
                    //Debug.LogWarning("The Npc Id [" + mp.beginNpcId.ToString() + "] spawn point is not exist");
                }
            }
            else
            {
                missionWnd.SetMissionAbout("None", "npc_big_Unknown", mp.objective);
            }

            // End Npc
            if (CustomGameData.Mgr.Instance != null &&
                CustomGameData.Mgr.Instance.curGameData.WorldIndex == mp.endNpcWorldIndex)
            {
                SpawnPoint sp = PeCustomScene.Self.spawnData.GetSpawnPoint(mp.endNpcId);
                if (sp as NPCSpawnPoint != null)
                {
                    NpcProtoDb.Item proto = NpcProtoDb.Get(sp.Prototype);
                    missionWnd.SetRewardInfo(sp.Name, proto.iconBig);
                }
                else if (sp as MonsterSpawnPoint != null)
                {
                    MonsterProtoDb.Item proto_mst = MonsterProtoDb.Get(sp.Prototype);
                    missionWnd.SetRewardInfo(sp.Name, proto_mst.icon);
                }
                else
                {
                    missionWnd.SetRewardInfo("None", "npc_big_Unknown");
                    Debug.LogWarning("The Npc Id [" + mp.endNpcId.ToString() + "] spawn point is not exist");
                }
            }
            else
            {
                missionWnd.SetRewardInfo("None", "npc_big_Unknown");
            }

            // Reward
            if (mp.rewardDesc != null)
            {
                missionWnd.SetRewardDesc(mp.rewardDesc);
            }
            else
            {
                _rewardItemIds   = mp.rewardItemIds;
                _rewardItemCount = mp.rewardItemCount;
                missionWnd.UpdateRewardItem(mp.rewardItemIds.Count);
            }
        }

        // goal
        if (_currentGoals != null)
        {
            AttachGoalEvent();
            missionWnd.UpdateGoalItem(_currentGoals.Count);
        }
    }
 SetValue(MissionProperty, value);