Пример #1
0
    public ShipController(ShipModel shipModel)
    {
        this.shipModel = shipModel;
        shipInfo = new ShipInfo(shipModel);

        GameObject go = new GameObject("Ship3DView");
        ship3DView = go.AddComponent<Ship3DView>();

        ship3DView.shipModel = shipModel;
        ship3DView.initializeAllBlocks();
    }
    public PlayerModel(Settings playerSettings, ShipModel.Factory shipFactory)
    {
        //order of initilaization is based on object graph, if object A is injected into B A is initalized first !

        ModelSettings = playerSettings;

        RxPlayerName = new ReactiveProperty<string>(playerSettings.playerName);
        RxPlayerScore = new ReactiveProperty<int>(playerSettings.initialScore);
        RxPlayerState = new ReactiveProperty<PlayerState>(PlayerState.Inactive);

        PlayerShip = shipFactory.Create(this, playerSettings.shipSettings);

        PlayerShip.RxShipState.Where(x => x == ShipModel.ShipState.Dead).Subscribe(x => { Deactivate(); });
    }
Пример #3
0
        private void UpdateSkillAtIndex(int index, ShipModel model)
        {
            var world     = nebulaObject.world as MmoWorld;
            var resSkills = world.Resource().Skills;

            if (model.SlotForSkillIndex(index).HasModule)
            {
                if (model.SlotForSkillIndex(index).Module.HasSkill)
                {
                    if (skills[index].IsEmpty || skills[index].data.Id != model.SlotForSkillIndex(index).Module.Skill)
                    {
                        skills[index].SetData(resSkills.Skill(model.SlotForSkillIndex(index).Module.Skill));
                    }
                }
                else
                {
                    if (!skills[index].IsEmpty)
                    {
                        skills[index].SetData(SkillData.Empty);
                    }
                }
            }
        }
Пример #4
0
        public ShipModel GetConsortShip(RevampRecipeDetailModel detail, out int ResourceID, out int voiceID)
        {
            ResourceID = 0;
            voiceID    = 0;
            if (Deck.Count < 2)
            {
                return(null);
            }
            ShipModel shipModel = Deck.GetShips()[1];

            if (shipModel == null)
            {
                return(null);
            }
            voiceID = detail.__mst__.Voice_id;
            if (voiceID == 0)
            {
                return(null);
            }
            ResourceID = detail.__mst__.GetVoiceShipId(shipModel.MstId);
            ResourceID = local.utils.Utils.GetResourceMstId(ResourceID);
            return(shipModel);
        }
        public void OnTouch()
        {
            if (!StrategyTopTaskManager.GetSailSelect().isRun)
            {
                return;
            }
            ShipModel flagShip = SingletonMonoBehaviour <AppInformation> .Instance.CurrentDeck.GetFlagShip();

            if (flagShip == null)
            {
                CommonPopupDialog.Instance.StartPopup("艦隊が編成されていません");
                return;
            }
            Initialize(flagShip);
            if (isShow)
            {
                Hide();
            }
            else
            {
                Show();
            }
        }
        public void Initialize(StrategyMapManager manager, MissionResultModel missionResultModel, KeyControl keyController, Action onSelectNextAction)
        {
            this.mMissionResultModel = missionResultModel;
            this.mTransform_TouchControlArea.SetActive(false);
            this.mStrategyMapManager = manager;
            this.mMissionJudgeCutIn.Initialize(this.mMissionResultModel.result);
            this.mMissionResultBonus.Inititalize(this.mMissionResultModel);
            this.mMissionResultStatus.Inititalize(this.mMissionResultModel);
            ShipModel shipModel = this.mMissionResultModel.Ships[0];

            this.mTexture_FlagShipGraphic.mainTexture = SingletonMonoBehaviour <ResourceManager> .Instance.ShipTexture.Load(shipModel.GetGraphicsMstId(), (!shipModel.IsDamaged())? 9 : 10);

            this.mTexture_FlagShipGraphic.MakePixelPerfect();
            this.mTexture_FlagShipGraphic.get_transform().set_localPosition(Util.Poi2Vec(shipModel.Offsets.GetShipDisplayCenter(shipModel.IsDamaged())));
            this.mLabel_AdmiralLevel.text           = this.mStrategyMapManager.UserInfo.Level.ToString();
            this.mLabel_AdmiralName.text            = this.mStrategyMapManager.UserInfo.Name;
            this.mLabel_AdmiralName.supportEncoding = false;
            this.mLabel_DeckName.text            = this.mStrategyMapManager.UserInfo.GetDeck(this.mMissionResultModel.DeckID).Name;
            this.mLabel_DeckName.supportEncoding = false;
            this.mLabel_MissionName.text         = this.mMissionResultModel.MissionName;
            this.mKeyController      = keyController;
            this.mOnSelectNextAction = onSelectNextAction;
        }
 internal void Release()
 {
     mUIRemodeModernzationTargetShipAction = null;
     mCommonShipBanner = null;
     mTransformLEVEL   = null;
     mLabel_Level      = null;
     mLabel_Name       = null;
     mSprite_Karyoku.RemoveFromPanel();
     mSprite_Karyoku = null;
     mSprite_Raisou.RemoveFromPanel();
     mSprite_Raisou = null;
     mSprite_Soukou.RemoveFromPanel();
     mSprite_Soukou = null;
     mSprite_Taikuu.RemoveFromPanel();
     mSprite_Taikuu = null;
     mSprite_Luck.RemoveFromPanel();
     mSprite_Luck = null;
     mSprite_Add.RemoveFromPanel();
     mSprite_Add = null;
     mButton_Action.Release();
     mButton_Action = null;
     mShipModel     = null;
 }
Пример #8
0
        private IEnumerator InitializeCoroutine(ShipModel shipModel, PowUpInfo powUpInfo)
        {
            Texture prevTexture      = mTexture_Ship.mainTexture;
            bool    aleadyKaryokuMax = shipModel.IsMaxKaryoku() && powUpInfo.Karyoku == 0;

            mUIDeckPracticeUpParameters[0].Initialize(shipModel.Karyoku - powUpInfo.Karyoku, shipModel.Karyoku, aleadyKaryokuMax);
            bool aleadyRaisouMax = shipModel.IsMaxRaisou() && powUpInfo.Raisou == 0;

            mUIDeckPracticeUpParameters[1].Initialize(shipModel.Raisou - powUpInfo.Raisou, shipModel.Raisou, aleadyRaisouMax);
            bool aleadyTaikuMax = shipModel.IsMaxTaiku() && powUpInfo.Taiku == 0;

            mUIDeckPracticeUpParameters[2].Initialize(shipModel.Taiku - powUpInfo.Taiku, shipModel.Taiku, aleadyTaikuMax);
            bool aleadyKaihiMax = shipModel.IsMaxKaihi() && powUpInfo.Kaihi == 0;

            mUIDeckPracticeUpParameters[3].Initialize(shipModel.Kaihi - powUpInfo.Kaihi, shipModel.Kaihi, aleadyKaihiMax);
            bool aleadyLuckyMax = shipModel.IsMaxLucky() && powUpInfo.Lucky == 0;

            mUIDeckPracticeUpParameters[4].Initialize(shipModel.Lucky - powUpInfo.Lucky, shipModel.Lucky, aleadyLuckyMax);
            bool aleadyTaisenMax = shipModel.IsMaxTaisen() && powUpInfo.Taisen == 0;

            mUIDeckPracticeUpParameters[5].Initialize(shipModel.Taisen - powUpInfo.Taisen, shipModel.Taisen, aleadyTaisenMax);
            yield return(new WaitForEndOfFrame());

            ResetPositionParameterSlot();
            mUIDeckPracticeShipInfo.Reposition();
            ResetPositionShip();
            mTexture_Ship.mainTexture = SingletonMonoBehaviour <ResourceManager> .Instance.ShipTexture.Load(shipModel.GetGraphicsMstId(), 9);

            mTexture_Ship.MakePixelPerfect();
            mTexture_Ship.transform.localPosition = Util.Poi2Vec(shipModel.Offsets.GetShipDisplayCenter(shipModel.IsDamaged()));
            if (prevTexture != null)
            {
                yield return(new WaitForEndOfFrame());

                Resources.UnloadAsset(prevTexture);
            }
        }
Пример #9
0
 public void Forward2KaizoAnimation(ShipModel targetShipModel)
 {
     if (status == ScreenStatus.MODE_KAIZO)
     {
         SetStatus(ScreenStatus.MODE_KAIZO_ANIMATION);
         if (instance.mRemodelGradeUpManager.GradeUp())
         {
             SoundUtils.PlaySE(SEFIleInfos.CommonEnter1);
             instance.mRemodelManager.ClearUnsetSlotsCache();
         }
         backGroundUpperSteelFrame.SetActive(isActive: false);
         backGroundLowerSteelFrame.SetActive(isActive: false);
         mUIRemodelShipStatus.SetActive(isActive: false);
         HideHeader();
         mUIRemodelHeader.SetActive(isActive: false);
         UpdateHeaderMaterial();
         StartCoroutine(StartGradeUpProductionCoroutine(targetShipModel, mKeyController, delegate
         {
             if (status == ScreenStatus.MODE_KAIZO_ANIMATION)
             {
                 status = ScreenStatus.MODE_KAIZO_END_ANIMATION;
                 if (otherShip)
                 {
                     mUIRemodelOtherShipPickerParent.Refresh(focusedShipModel);
                 }
                 mUIRemodelShipStatus.SetActive(isActive: true);
                 ShowHeader();
                 mUIRemodelHeader.SetActive(isActive: true);
                 ChangeFocusShip(targetShipModel);
                 backGroundUpperSteelFrame.SetActive(isActive: true);
                 backGroundLowerSteelFrame.SetActive(isActive: true);
                 mUIRemodelModeSelectMenu.Init(mKeyController, mRemodelGradeUpManager.GradeupBtnEnabled);
                 Forward2ModeSelect();
             }
         }));
     }
 }
Пример #10
0
        public List <ShipModel> GetAreaShips(int area_id, bool use_deck, bool use_edeck, List <ShipModel> all_ships)
        {
            List <ShipModel> list         = new List <ShipModel>();
            MapAreaModel     mapAreaModel = _area[area_id];

            if (use_deck)
            {
                DeckModel[] decks = mapAreaModel.GetDecks();
                DeckModel[] array = decks;
                foreach (DeckModel deckModel in array)
                {
                    list.AddRange(deckModel.GetShips());
                }
            }
            if (use_edeck)
            {
                list.AddRange(mapAreaModel.GetEscortDeck().GetShips());
            }
            HashSet <int> hashSet = mapAreaModel.__GetRepairingShipMemIdsHash__();

            foreach (int item in hashSet)
            {
                ShipModel ship2 = UserInfo.GetShip(item);
                if (ship2.IsInDeck() == -1 && ship2.IsInEscortDeck() == -1)
                {
                    list.Add(ship2);
                }
            }
            if (all_ships == null)
            {
                all_ships = UserInfo.__GetShipList__();
            }
            List <ShipModel> collection = all_ships.FindAll((ShipModel ship) => ship.IsBlingWait() && ship.AreaIdBeforeBlingWait == area_id);

            list.AddRange(collection);
            return(list);
        }
Пример #11
0
        public void ChangeCharacter(Live2DModelUnity Live2D, ShipModel model)
        {
            Point live2dBias  = model.Offsets.GetLive2dBias();
            float x           = live2dBias.x;
            Point live2dBias2 = model.Offsets.GetLive2dBias();

            L2dBias = new Vector3(x, live2dBias2.y, 0f);
            Point boko  = model.Offsets.GetBoko(damaged: false);
            float x2    = boko.x;
            Point boko2 = model.Offsets.GetBoko(damaged: false);

            ShipIn = new Vector3(x2, boko2.y, 0f);
            Point cutinSp1_InBattle = model.Offsets.GetCutinSp1_InBattle(damaged: false);
            float x3 = cutinSp1_InBattle.x;
            Point cutinSp1_InBattle2 = model.Offsets.GetCutinSp1_InBattle(damaged: false);

            ShipIn2 = new Vector3(x3, cutinSp1_InBattle2.y, 0f);
            Point boko3 = model.Offsets.GetBoko(damaged: false);

            ShipOut            = new Vector3(1300f, boko3.y, 0f);
            Render.mainTexture = SingletonMonoBehaviour <Live2DModel> .Instance.ChangeCharacter(Live2D, model);

            UITexture render     = Render;
            Point     live2dSize = model.Offsets.GetLive2dSize();

            render.width = (int)((float)live2dSize.x * 1.25f);
            UITexture render2     = Render;
            Point     live2dSize2 = model.Offsets.GetLive2dSize();

            render2.height = live2dSize2.y;
            Transform transform   = base.transform;
            Point     boko4       = model.Offsets.GetBoko(damaged: false);
            int       y           = boko4.y;
            Point     live2dBias3 = model.Offsets.GetLive2dBias();

            transform.localPositionY(y + live2dBias3.y);
        }
Пример #12
0
		public bool IsValidShip(ShipModel ship)
		{
			if (ship == null)
			{
				return false;
			}
			if (ship.IsInRepair())
			{
				return false;
			}
			if (ship.IsInMission())
			{
				return false;
			}
			if (ship.IsBling())
			{
				return false;
			}
			if (ship.IsInActionEndDeck())
			{
				return false;
			}
			return true;
		}
Пример #13
0
        private void ChangeStateCommandMenu()
        {
            if (this.mIsEndPhase)
            {
                return;
            }
            bool flag = StrategyTopTaskManager.GetLogicManager().IsValidDeploy(StrategyTopTaskManager.Instance.TileManager.FocusTile.areaID, this.top.TankerCount, EscortOrganizeTaskManager.GetEscortManager());

            if (flag)
            {
                StrategyTopTaskManager.GetLogicManager().Deploy(this.top.areaID, this.top.TankerCount, EscortOrganizeTaskManager.GetEscortManager());
                StrategyTopTaskManager.CreateLogicManager();
                this.isPlayVoice         = false;
                this.EscortFlagShipModel = null;
                this.top.backToCommandMenu();
                this.mIsEndPhase = true;
                SoundUtils.PlaySE(SEFIleInfos.CommonEnter1);
                if (this.PanelShowCor != null)
                {
                    base.StopCoroutine(this.PanelShowCor);
                }
                TutorialModel tutorial = StrategyTopTaskManager.GetLogicManager().UserInfo.Tutorial;
                if (tutorial.GetStep() == 8 && !tutorial.GetStepTutorialFlg(9))
                {
                    tutorial.SetStepTutorialFlg(9);
                    CommonPopupDialog.Instance.StartPopup("「はじめての配備!」 達成");
                    SoundUtils.PlaySE(SEFIleInfos.SE_012);
                }
                StrategyTopTaskManager.Instance.setActiveStrategy(true);
            }
            else
            {
                SoundUtils.PlaySE(SEFIleInfos.CommonCancel2);
                CommonPopupDialog.Instance.StartPopup("変更がありません", 0, CommonPopupDialogMessage.PlayType.Long);
            }
        }
Пример #14
0
        private IEnumerator StartGradeUpProductionCoroutine(ShipModel targetShipModel, KeyControl keyController, Action OnFinishedAnimation)
        {
            SingletonMonoBehaviour <UIShortCutMenu> .Instance.IsInputEnable = false;
            PortUpgradesConvertShipManager kaizouAnimation = Util.Instantiate(mPrefab_PortUpgradesConvertShipManager_KaizouAnimation.gameObject, base.gameObject).GetComponent <PortUpgradesConvertShipManager>();

            kaizouAnimation.SetKeyController(keyController);
            kaizouAnimation.transform.localPosition = new Vector3(0f, 0f, 0f);
            kaizouAnimation.transform.localScale    = new Vector3(1f, 1f, 1f);
            kaizouAnimation.enabled = true;
            kaizouAnimation.Initialize(targetShipModel, 2, 5, 1);
            while (!kaizouAnimation.isFinished)
            {
                yield return(null);
            }
            if (OnFinishedAnimation != null)
            {
                UnityEngine.Object.Destroy(kaizouAnimation.gameObject);
                OnFinishedAnimation();
                SingletonMonoBehaviour <FadeCamera> .Instance.FadeIn(0.2f, delegate
                {
                    SingletonMonoBehaviour <UIShortCutMenu> .Instance.IsInputEnable = true;
                });
            }
        }
Пример #15
0
        private List <ShipModel> ToShipModel(List <TrajectoryModel> trajectories)
        {
            if (trajectories == null || trajectories.Count == 0)
            {
                return(new List <ShipModel>());
            }

            var result = new List <ShipModel>();

            foreach (var trajectory in trajectories)
            {
                var ship = new ShipModel
                {
                    ShipID   = trajectory.ShipID,
                    ShipName = trajectory.ShipName,
                    ShipType = trajectory.ShipType,
                    Geometry = trajectory.Geometry
                };

                result.Add(ship);
            }

            return(result);
        }
Пример #16
0
        private IEnumerator StartProductionShipResult(ShipModel shipModel, ShipExpModel expModel, PowUpInfo powUpInfo)
        {
            if (DOTween.IsTweening(this))
            {
                DOTween.Kill(this);
            }
            bool animationNow = true;

            yield return(StartCoroutine(InitializeCoroutine(shipModel, powUpInfo)));

            mUIDeckPracticeShipInfo.Initialize(shipModel, expModel);
            WaitForKeyOrTouch(mKeyController, delegate
            {
                this.mKeyController.ClearKeyAll();
                this.mKeyController.firstUpdate = true;
                DOTween.Kill(this, complete: true);
            });
            Sequence seq = DOTween.Sequence().SetId(this);

            seq.Append(GenerateTweenShipIn());
            seq.Join(mUIDeckPracticeShipInfo.GenerateTweenExpAndLevel());
            seq.Join(GenerateTweenParameterResult());
            ShipUtils.PlayShipVoice(shipModel, local.utils.Utils.GetSpecialVoiceId(shipModel.MstId));
            yield return(seq.WaitForStart());

            yield return(StartCoroutine(WaitForKeyOrTouch(mKeyController, delegate
            {
                animationNow = false;
            })));

            while (animationNow)
            {
                yield return(null);
            }
            yield return(null);
        }
Пример #17
0
        public override string ToString()
        {
            string str = "--SupplyManager--\n";

            str += base.ToString();
            string text = str;

            str  = text + "\n[補給に必要な資材数]燃料/弾薬:" + FuelForSupply + "/" + AmmoForSupply + "\n";
            str += string.Format("燃料補給:{0} 弾薬補給:{1} まとめて補給:{2}\n", (!IsValidSupply(SupplyType.Fuel)) ? "不可" : "可", (!IsValidSupply(SupplyType.Ammo)) ? "不可" : "可", (!IsValidSupply(SupplyType.All)) ? "不可" : "可");
            str  = (IsShowOther() ? (str + $"他艦選択中\n") : (str + $"選択中の艦隊ID:{SelectedDeck.Id}\n"));
            str += _GetString_CheckedShip();
            str += "\n";
            str += $"\n{ToString(CheckBoxALLState)}\n";
            for (int i = 0; i < Ships.Length; i++)
            {
                ShipModel shipModel = Ships[i];
                if (shipModel != null)
                {
                    str += $"{ToString(CheckBoxStates[i])}{shipModel.ShortName} Lv{shipModel.Level}";
                    str += $" Fuel:{shipModel.Fuel}/{shipModel.FuelMax} Ammo:{shipModel.Ammo}/{shipModel.AmmoMax}\n";
                }
            }
            return(str + "\n-----------------");
        }
 private void OnUpdateShipDestroyConfirm()
 {
     if (KeyController.IsLeftDown())
     {
         mStateManager.PopState();
         mStateManager.ResumeState();
     }
     else if (!KeyController.IsRightDown())
     {
         if (KeyController.IsMaruDown())
         {
             CommonPopupDialog.Instance.StartPopup("解体は □ボタンで行います");
         }
         else if (KeyController.IsBatuDown())
         {
             RequestBackTransitionFromShipDestroyConfirm();
         }
         else if (KeyController.IsShikakuDown() && mStateManager.CurrentState == State.ShipDestroyConfirm)
         {
             ShipModel selectedShip = ShipScroll.SelectedShip;
             StartKaitai(selectedShip);
         }
     }
 }
        public void ChangeCharacter(DeckModel deck)
        {
            ShipModel shipModel = deck.GetFlagShip();

            if (deck != null && deck.MissionState != MissionStates.NONE)
            {
                shipModel = null;
            }
            if (SingletonMonoBehaviour <Live2DModel> .Instance != null && !SingletonMonoBehaviour <Live2DModel> .Instance.isLive2DModel && StrategyShipCharacter.nowShipModel != null && shipModel != null && (StrategyShipCharacter.nowShipModel.GetGraphicsMstId() != shipModel.GetGraphicsMstId() || !shipModel.IsDamaged()) && this.Render != null && this.Render.mainTexture != null)
            {
                Resources.UnloadAsset(this.Render.mainTexture);
                this.Render.mainTexture = null;
            }
            base.ChangeCharacter(shipModel, deck.Id);
            StrategyShipCharacter.nowShipModel = shipModel;
            if (this.collision != null)
            {
                this.collision.ResetTouchCount();
                if (this.Render != null)
                {
                    this.collision.SetCollisionHight(this.Render.height);
                }
            }
        }
 private void UpdateKaitaiMaterialsInfo(ShipModel setShip)
 {
     if (setShip == null)
     {
         for (int i = 0; i < 4; i++)
         {
             this._materialObj[i].SetActive(false);
         }
     }
     else
     {
         int[] array = new int[4];
         for (int j = 0; j < 4; j++)
         {
             array[j] = 0;
         }
         MaterialInfo resourcesForDestroy = setShip.GetResourcesForDestroy();
         array[0] = resourcesForDestroy.Fuel;
         array[1] = resourcesForDestroy.Ammo;
         array[2] = resourcesForDestroy.Steel;
         array[3] = resourcesForDestroy.Baux;
         for (int k = 0; k < 4; k++)
         {
             if (array[k] > 0)
             {
                 this._materialObj[k].SetActive(true);
                 UILabel component = this._materialObj[k].get_transform().FindChild("LabelMaterial").GetComponent <UILabel>();
                 component.textInt = array[k];
             }
             else
             {
                 this._materialObj[k].SetActive(false);
             }
         }
     }
 }
 public virtual void SetBanner(ShipModel ship, int idx)
 {
     SetEnabled((ship != null) ? true : false);
     Ship     = ship;
     this.idx = idx;
     selected = false;
     if (base.enabled)
     {
         UpdateCheckBoxBackground();
         UpdateCheckBox();
         _checkBox.SetActive(isActive: true);
         _check.SetActive(isActive: false);
         _shipName.text   = Ship.Name;
         _shipLevel.text  = "Lv" + Ship.Level;
         _shipTaikyu.text = Ship.NowHp + "/" + Ship.MaxHp;
         float num  = (float)Ship.NowHp / (float)Ship.MaxHp;
         float num2 = (float)_shipGaugeFrame.width * num;
         _shipGauge.width      = (int)num2;
         _shipGauge.alpha      = 1f;
         _shipGaugeFrame.alpha = 1f;
         _shipGauge.color      = Util.HpGaugeColor2(ship.MaxHp, ship.NowHp);
         int num3 = 0;
         for (int i = 0; i < 10 && ship.Ammo > ship.AmmoMax / 5 * i; i++)
         {
             num3++;
         }
         _ammoStorage.init(num3, 0.2f);
         int num4 = 0;
         for (int j = 0; j < 5 && ship.Fuel > ship.FuelMax / 5 * j; j++)
         {
             num4++;
         }
         _fuelStorage.init(num4, 0.2f);
         UpdateCheckBoxBackground();
     }
 }
Пример #22
0
 public void setIcon(ShipModel ship)
 {
     this.ship = ship;
     moveIcon(0f);
 }
 public void SetShip(ShipModel shi)
 {
     this.ship = shi;
     this.sw   = GameObject.Find("sw01").GetComponent <sw>();
     this.sw.setSW(false);
 }
Пример #24
0
        public bool IsValidGradeUp(ShipModel ship)
        {
            Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship.get_Item(ship.MstId);

            return(mst_ship.Aftershipid > 0 && ship.Level >= mst_ship.Afterlv);
        }
 public void SetCurrentFocusToShip(ShipModel shipModel)
 {
     this.mCurrentFocusTargetShipSlot.Initialize(shipModel);
     this.UpdateStartButtonEnabled();
 }
Пример #26
0
 public ShipInfo(ShipModel shipModel)
 {
     this.shipModel = shipModel;
 }
Пример #27
0
 internal Ship()
 {
     Model = new ShipModel();
 }
Пример #28
0
    public override void RemoveElement(AUnitElementModel element) {
        base.RemoveElement(element);

        // remove the formationStation from the ship and the ship from the FormationStation
        var ship = element as ShipModel;
        var shipFst = ship.Data.FormationStation;
        shipFst.AssignedShip = null;
        ship.Data.FormationStation = null;

        if (!this.IsAlive) {
            // fleetCmd has died
            return;
        }

        if (ship == HQElement) {
            // HQ Element has left
            HQElement = SelectHQElement();
        }
    }
Пример #29
0
 public void TransferShip(ShipModel ship, FleetCmdModel fleetCmd) {
     // UNCLEAR does this ship need to be in ShipState.None while these changes take place?
     RemoveElement(ship);
     ship.IsHQElement = false; // Needed - RemoveElement never changes HQ Element as the TransferCmd is dead as soon as ship removed
     fleetCmd.AddElement(ship);
 }
Пример #30
0
 internal void OnHQElementChanging(ShipModel oldHQElement, ShipModel newHQElement) {
     if (oldHQElement != null) {
         oldHQElement.onDestinationReached -= OnFlagshipReachedDestination;
     }
     if (IsAutoPilotEngaged) {   // if not engaged, this connection will be established when next engaged
         newHQElement.onDestinationReached += OnFlagshipReachedDestination;
     }
 }
Пример #31
0
 public static ShipAttackTask CreateAndStartTask(ShipModel ship, Action<ATask> onCompletion = null) {
     var task = new ShipAttackTask(ship, onCompletion);
     TaskMgr.AddTask(task);
     return task;
 }
Пример #32
0
 public ShipAttackTask(ShipModel ship, Action<ATask> onCompletion = null) {
     _ship = ship;
     this.onCompletion += onCompletion;
 }
Пример #33
0
 public EngineRoom(ShipModel ship) {
     _shipData = ship.Data;
     _shipRigidbody = ship.rigidbody;
     _shipRigidbody.useGravity = false;
     _gameSpeedMultiplier = GameTime.Instance.GameSpeed.SpeedMultiplier();   // FIXME where/when to get initial GameSpeed before first GameSpeed change?
     //D.Log("{0}.EngineRoom._gameSpeedMultiplier is {1}.", ship.FullName, _gameSpeedMultiplier);
     Subscribe();
 }
 private void UpdateKaitaiInfo(ShipModel shipModel)
 {
     this.UpdateKaitaiShipInfo(shipModel);
     this.UpdateKaitaiMaterialsInfo(shipModel);
 }
Пример #35
0
 private void OnFleetElementDestroyed(ShipModel ship) {
     if (ship.gameObject.GetSafeInterface<ICameraFocusable>().IsFocus) {
         // our fleet's ship that was just destroyed was the focus, so change the focus to the fleet
         (View as ICameraFocusable).IsFocus = true;
     }
 }
Пример #36
0
        public Ship(Game1 game)
            : base(game)
        {
            this.game = game;

            lastNodePos = Vector2.Zero;
            pos = new Vector3(90, 4.5f, 0);
            moveSpeed = 0;
            accel = 0.5f;
            maxSpeed = 0.2f;
            boostSpeed = 0.6f;
            direction = new Vector3(0, 0, -1);
            currentTurnSpeed = 0;
            maxTurnSpeed = MathHelper.PiOver4 / 30;

            boundingBox = new OOBB(pos, direction, 1.5f, 1.5f); // Need to be changed to be actual ship dimentions
            circleCol = new CircleCollider(pos, 0.75f);

            shipModel = new ShipModel(this, game);
            //shipModel = new ShipModel(game.Content.Load<Model>(@"Models/Enemies/Cubes/guncube"), this);
            skyboxModel = new SkyboxModel(game.Content.Load<Model>(@"Models/Misc/Skybox/skybox"), this);
            speedCyl = new SpeedCylModel(game.Content.Load<Model>(@"Models/Misc/speedCyl"), this, ((Game1)Game));
            rbowTun = new RainbowTunnelModel(game.Content.Load<Model>(@"Models/Misc/Rbow/rbowTun"), this, ((Game1)Game));

            game.modelManager.addObject(shipModel);
            game.modelManager.add(skyboxModel);
            game.modelManager.addObject(rbowTun);
            game.modelManager.addTransparent(speedCyl);

            weapons = new WeaponSystem(this, this.game);
            moneyManager = new MoneyManager(this.game);
            particles = new ShipParticleSystem(this.game, this);
            shipHealth = new ShipHealthSystem(this.game, this);

            game.Components.Add(weapons);
            game.Components.Add(moneyManager);
            game.Components.Add(particles);
            game.Components.Add(shipHealth);

            ((WeaponDrill)weapons.weapons.ElementAt(4)).dome.setShip(this);
            alive = true;
        }
Пример #37
0
 public static Texture2D LoadTexture(ShipModel model, bool isDamaged)
 {
     return(LoadTexture(model.GetGraphicsMstId(), (!isDamaged) ? 9 : 10));
 }
Пример #38
0
 public static Texture2D LoadTexture(ShipModel model, int texNum)
 {
     return(LoadTexture(model.GetGraphicsMstId(), texNum));
 }
Пример #39
0
        //first call after ctr, so we do init here
        public void Awake()
        {
            Debug.Log("GA WhichData::Awake");

            //initialize sub components.
            string error = string.Empty;
            for(int i = Active; i < ModelCount; ++i)
            {
                m_shipModels[i] = new ShipModel();
                m_guiViews[i] = new GUIView();

                error += m_shipModels[i].Initialize(this, i);
                error += m_guiViews[i].Initialize(this, i);
            }

            if (error != string.Empty)
            {
                //They can fail, cascading a cleanup & shutdown of the mod.
                //TODOJEFFGIFFEN i teardowns
                Debug.Log("Giffen Aerospace WhichData error: " + error);
                return;
            }

            for (int i = Active; i < ModelCount; ++i)
            {
                //faultless inits
                m_selectedLists[i] = new List<DataPage>();
                m_selectedDirty[i] = false;

                //passthrough the Awake events
                m_shipModels[i].OnAwake();
                m_guiViews[i].OnAwake();
            }

            GameEvents.onVesselChange.Add(OnVesselSwitchEvent);     //load/launch/quick switch
            GameEvents.onVesselLoaded.Add(OnVesselLoaded);          //when it physically loads (2.5kmish)

            instance = this;
        }
Пример #40
0
 public static Texture2D LoadCardTexture(ShipModel model)
 {
     return(LoadCardTexture(model, model.IsDamaged()));
 }
Пример #41
0
 public void RemoveShip(ShipModel ship) {
     bool isRemoved = Ships.Remove(ship);
     isRemoved = isRemoved && Data.RemoveShip(ship.Data);
     D.Assert(isRemoved, "{0} not found.".Inject(ship.Data.Name));
     if (Ships.Count > Constants.Zero) {
         if (ship == Flagship) {
             // LeadShip has died
             Flagship = SelectBestShip();
         }
         return;
     }
     // Fleet knows when to die
 }
 public void Initialize(KeyControl keyController, ShipModel shipModel)
 {
     keyController.ClearKeyAll();
     keyController.firstUpdate = true;
     this.keyController        = keyController;
     base.set_enabled(true);
     this.ship          = shipModel;
     this.validShip     = UserInterfaceRemodelManager.instance.IsValidShip();
     this.validUnsetAll = UserInterfaceRemodelManager.instance.mRemodelManager.IsValidUnsetAll(UserInterfaceRemodelManager.instance.focusedShipModel.MemId);
     UIRemodelEquipSlotItem[] array = this.slots;
     for (int i = 0; i < array.Length; i++)
     {
         UIRemodelEquipSlotItem uIRemodelEquipSlotItem = array[i];
         if (this.validShip)
         {
             uIRemodelEquipSlotItem.SetOnUIRemodelEquipSlotItemActionListener(new UIRemodelEquipSlotItem.UIRemodelEquipSlotItemAction(this.UIRemodelEquipSlotItemAction));
         }
         else
         {
             uIRemodelEquipSlotItem.SetOnUIRemodelEquipSlotItemActionListener(null);
         }
         uIRemodelEquipSlotItem.Hide();
     }
     this.InitSlotItems(this.ship);
     ParameterType[] array2 = new ParameterType[]
     {
         ParameterType.Taikyu,
         ParameterType.Karyoku,
         ParameterType.Soukou,
         ParameterType.Raisou,
         ParameterType.Kaihi,
         ParameterType.Taiku,
         ParameterType.Tous,
         ParameterType.Taisen,
         ParameterType.Soku,
         ParameterType.Sakuteki,
         ParameterType.Leng,
         ParameterType.Lucky
     };
     int[] array3 = new int[]
     {
         shipModel.MaxHp,
         shipModel.Karyoku,
         shipModel.Soukou,
         shipModel.Raisou,
         shipModel.Kaihi,
         shipModel.Taiku,
         shipModel.TousaiMaxAll,
         shipModel.Taisen,
         shipModel.Soku,
         shipModel.Sakuteki,
         shipModel.Leng,
         shipModel.Lucky
     };
     for (int j = 0; j < array2.Length; j++)
     {
         UIRemodelParameter component = this.parameters.get_transform().GetChild(j).GetComponent <UIRemodelParameter>();
         component.Initialize(array2[j], array3[j]);
     }
     this.currentFocusItem = null;
     this._BeforeItem      = this.slots[0];
     this.Focus();
 }
Пример #43
0
 /// <summary>
 /// Adds the ship to this fleet including parenting if needed.
 /// </summary>
 /// <param name="ship">The ship.</param>
 public void AddShip(ShipModel ship) {
     Ships.Add(ship);
     Data.AddShip(ship.Data);
     Transform parentFleetTransform = gameObject.GetSafeFirstMonoBehaviourInParents<FleetUnitCreator>().transform;
     if (ship.transform.parent != parentFleetTransform) {
         ship.transform.parent = parentFleetTransform;   // local position, rotation and scale are auto adjusted to keep ship unchanged in worldspace
     }
     //TODO consider changing flagship
 }
Пример #44
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShipHelm" /> class.
 /// </summary>
 /// <param name="ship">The ship.</param>
 public ShipHelm(ShipModel ship) {
     _ship = ship;
     _gameTime = GameTime.Instance;
     _gameSpeedMultiplier = _gameTime.GameSpeed.SpeedMultiplier();   // FIXME where/when to get initial GameSpeed before first GameSpeed change?
     _engineRoom = new EngineRoom(_ship);
     Subscribe();
 }
Пример #45
0
 public AutoPilot(ShipModel ship) {
     _ship = ship;
     _shipData = ship.Data;
     _courseUpdateFrequency /= GameTime.Instance.GameSpeed.SpeedMultiplier();
     Subscribe();
 }
Пример #46
0
 public virtual bool Init(ShipModel ship, UITexture _texture)
 {
     return(true);
 }
Пример #47
0
        private void PMReset(ModuleScienceExperiment experi, ShipModel ship)
        {
            //condition to meet before we signal controller
            Func<bool> pollForReset = () => //experi get captured into the delegate
            {
                //wait for module to reset
                if (experi.GetData().Length > 0) { return false; }

                //alert model
                ship.FireScienceEvent();
                return true;
            };

            m_rightClickEvents.Add(pollForReset);
        }
Пример #48
0
 public void Initialize(KeyControl keyController, ShipModel shipModel)
 {
     keyController.ClearKeyAll();
     keyController.firstUpdate = true;
     this.keyController        = keyController;
     base.enabled  = true;
     ship          = shipModel;
     validShip     = UserInterfaceRemodelManager.instance.IsValidShip();
     validUnsetAll = UserInterfaceRemodelManager.instance.mRemodelManager.IsValidUnsetAll(UserInterfaceRemodelManager.instance.focusedShipModel.MemId);
     UIRemodelEquipSlotItem[] array = slots;
     foreach (UIRemodelEquipSlotItem uIRemodelEquipSlotItem in array)
     {
         if (validShip)
         {
             uIRemodelEquipSlotItem.SetOnUIRemodelEquipSlotItemActionListener(UIRemodelEquipSlotItemAction);
         }
         else
         {
             uIRemodelEquipSlotItem.SetOnUIRemodelEquipSlotItemActionListener(null);
         }
         uIRemodelEquipSlotItem.Hide();
     }
     InitSlotItems(ship);
     ParameterType[] array2 = new ParameterType[12]
     {
         ParameterType.Taikyu,
         ParameterType.Karyoku,
         ParameterType.Soukou,
         ParameterType.Raisou,
         ParameterType.Kaihi,
         ParameterType.Taiku,
         ParameterType.Tous,
         ParameterType.Taisen,
         ParameterType.Soku,
         ParameterType.Sakuteki,
         ParameterType.Leng,
         ParameterType.Lucky
     };
     int[] array3 = new int[12]
     {
         shipModel.MaxHp,
         shipModel.Karyoku,
         shipModel.Soukou,
         shipModel.Raisou,
         shipModel.Kaihi,
         shipModel.Taiku,
         shipModel.TousaiMaxAll,
         shipModel.Taisen,
         shipModel.Soku,
         shipModel.Sakuteki,
         shipModel.Leng,
         shipModel.Lucky
     };
     for (int j = 0; j < array2.Length; j++)
     {
         UIRemodelParameter component = ((Component)parameters.transform.GetChild(j)).GetComponent <UIRemodelParameter>();
         component.Initialize(array2[j], array3[j]);
     }
     currentFocusItem = null;
     _BeforeItem      = slots[0];
     Focus();
 }
Пример #49
0
 public ShipDestinationInfo(ShipModel ship, bool isEnemy) {
     Target = ship;
     _fstOffset = Vector3.zero;
     if (isEnemy) {
         _closeEnoughDistanceRef = new Reference<float>(() => ship.Radius + 5F + ship.MaxWeaponsRange);
     }
     else {
         _closeEnoughDistance = ship.Radius + 5F;
     }
     _progressCheckDistance = 5F;
 }