public WarshipL CreateWarship(GirlData data, WarshipL.CreateCallback callback)
    {
        WarshipL ws = GetWarship(data.roleCardId);

        if (ws != null)
        {
            return(ws);
        }

        ws = new WarshipL(data);
        ws.Initialize(delegate(WarshipL ws1)
        {
            _mWarshipList.Add(ws);
            if (null != callback)
            {
                callback(ws);
            }
        });


        // LocateFleetPosition();
        // CalculateFleetRect();

        return(ws);
    }
    /// <summary>
    /// Replaces the actor model instead of specific model
    /// </summary>
    /// <param name='_originalModel'>
    /// _original model.
    /// </param>
    private void ReplaceActor(GameObject _originalModel)
    {
        if (Globals.Instance.MGameDataManager == null)
        {
            return;
        }

        PlayerData actorData = Globals.Instance.MGameDataManager.MActorData;
        GirlData   t_wsData  = actorData.GetActorFakeWarshipData();

        if (t_wsData != null)
        {
//			ReplaceModel(t_wsData.BasicData.ModelName,_originalModel,delegate(Object obj,string error){
//				mReplaceActorObj = (GameObject)obj;
//
//				mPlayerName = WarshipL.Create3DNameImpl(mReplaceActorObj,actorData.BasicData.FleetName);
//
//				// change the layer to enable render in cutscene mode
//				mPlayerName.gameObject.layer = 11;
//				for(int i = 0;i < mPlayerName.transform.childCount;i++){
//					mPlayerName.transform.GetChild(i).gameObject.layer = 11;
//				}
//			});
        }
    }
Beispiel #3
0
    private string GetTypeText(GirlData data)
    {
//		string val = GUIFontColor.Orange + data.BasicData.TypeName;
        string val = GUIFontColor.Orange;

        return(val);
    }
Beispiel #4
0
    private string GetNameText(GirlData data)
    {
        string MColor = GUIFontColor.White;
//		switch(data.BasicData.RarityLevel)
//		{
//		case 1:
//			MColor = GUIFontColor.White;
//			break;
//		case 2:
//			MColor = GUIFontColor.PureGreen;
//			break;
//		case 3:
//			MColor = GUIFontColor.PureBlue;
//			break;
//		case 4:
//			MColor = GUIFontColor.Purple;
//			break;
//		case 5:
//			MColor = GUIFontColor.Orange;
//			break;
//		}
//		Debug.Log(MColor+data.BasicData.RarityLevel);
        string val = MColor + data.CardBase.CardName;;

        return(val);
    }
Beispiel #5
0
    private void BuildTips(GirlData data)
    {
        float totalWidth  = _mNameText.maxWidth;
        float totalHeight = 0.0f;

        totalHeight += TOP_SPACE;         // Top

        string val = GetNameText(data);

        _mNameText.Text = val;
        //totalHeight += _mNameText.LineSpan;

        // Calculate the star position and cutline position
        //float tempHeight = totalHeight;

        // Add quality star line
        val = "\n";
//		tempHeight += _mContentText.characterSize;
//		for (int i = 0; i < MAX_STAR_COUNT; ++i)
//		{
//			GameObject go = BuildStar();
//			go.name = "Star";
//
//			_mQualityStarList.Add(go, tempHeight);
//		}

        val += GetTypeText(data) + "\n";
//		// CutLine, skip one line
//		val += "\n";
//		{
//			tempHeight += 2 * _mContentText.LineSpan;
//			GameObject go = BuildCutLine();
//			go.name = "CutLine";
//
//			_mCutLineList.Add(go, tempHeight);
//		}

        val += GetTonnageText(data) + "\n";
        val += GetAttackPropertyText(data) + "\n";
        // CutLine, skip one line
//		val += "\n";
//		{
//			tempHeight += 5 * _mContentText.LineSpan;
//			GameObject go = BuildCutLine();
//			go.name = "CutLine";
//
//			_mCutLineList.Add(go, tempHeight);
//		}
        val += GetBasePropertyText(data) + "\n";
        val += GetCaptainText(data) + "\n";
        val += GetCardInfoText(data) + "\n";
        _mContentText.Text = val;
        // Resize the SpriteText height
        totalHeight += _mContentText.TopLeft.y - _mContentText.BottomRight.y;
        totalHeight += BOTTOM_SPACE;         // Bottom

        _mToolTips.GUIWidth  = totalWidth;
        _mToolTips.GUIHeight = totalHeight;
    }
Beispiel #6
0
        public override void Bind(BaseEntity2D owner)
        {
            this.owner = owner;

            girl = owner.data as GirlData;

            Load(UserManager.GetInstance().user.GetActiveWeapon());
        }
Beispiel #7
0
    private string GetCardInfoText(GirlData data)
    {
        string wordText = Globals.Instance.MDataTableManager.GetWordText(20800028);
        string text     = Globals.Instance.MDataTableManager.GetWordText(20800029);
        string val      = GUIFontColor.Color10H + wordText + text;

        return(val);
    }
Beispiel #8
0
    private string GetTonnageText(GirlData data)
    {
        string wordText = Globals.Instance.MDataTableManager.GetWordText(20800020);
//		string val = GUIFontColor.White + wordText + data.BasicData.Tonnage;
        string val = GUIFontColor.White + wordText;

        return(val);
    }
        public override void OnSkillHit(BaseEntity2D sender, SkillData skill, Vector2 point)
        {
            if (sender != null && machine.currentState.GetName() != StateTypes.Dead.ToString())
            {
                GirlData girl = sender.data as GirlData;

                data.attributeBox.Validate(ValidateType.Injured, girl.attributeBox, skill, point);
            }
        }
    public void UpdateAvatarIcon(string icon)
    {
        warshipData = null;

        SetHightlight(false);
        NGUITools.SetActive(pinzhiIcon.gameObject, false);
        NGUITools.SetActive(iconSelect.gameObject, false);

        knightIcon.spriteName = icon;
    }
        private GirlEntity2D CreateGirlEntity(GirlData girlData)
        {
            GirlEntity2D entity = ResourceUtils.GetComponent <GirlEntity2D>(GlobalDefinitions.RESOURCE_PATH_GIRL + girlData.resourceID);

            entity.BindData(girlData);

            LayerManager.GetInstance().AddObject(entity.transform);
            entity.transform.position = mapWrapper.girlSpawnPoint.Value;

            return(entity);
        }
Beispiel #12
0
	void Start()
    {
        root = GameObject.Find("UI Root");
        ps = transform.GetComponent<PanelSwitch>();
        tm = transform.GetComponent<TextManager>();
        im = transform.GetComponent<ImageManager>();
        playerdata = new UserData();
        for(int i = 0; i < 7; i++)
        {
            girl[i] = new GirlData(i);
        }
    }
    public void UpdateSlot(GirlData data)
    {
        warshipData = data;

        SetChecked(false);
        eventBtn.Data = data;

        NGUITools.SetActive(pinzhiIcon.gameObject, false);
//		pinzhiIcon.spriteName =  PinzhiIconNames[data.BasicData.RarityLevel - 1];

//		knightIcon.spriteName = data.BasicData.Icon;
    }
Beispiel #14
0
    private string GetBasePropertyText(GirlData data)
    {
        string wordText = Globals.Instance.MDataTableManager.GetWordText(20800024);
        string val      = GUIFontColor.White + wordText + data.PropertyData.Defense + "\n";

        wordText = Globals.Instance.MDataTableManager.GetWordText(20800025);
        val     += GUIFontColor.White + wordText + data.PropertyData.Life + "\n";
        wordText = Globals.Instance.MDataTableManager.GetWordText(20800026);
        val     += GUIFontColor.White + wordText + data.PropertyData.Range;

        return(val);
    }
Beispiel #15
0
    private string GetAttackPropertyText(GirlData data)
    {
        string wordText = Globals.Instance.MDataTableManager.GetWordText(20800021);
        string val      = GUIFontColor.White + wordText + data.PropertyData.SeaAttack + "\n";

        wordText = Globals.Instance.MDataTableManager.GetWordText(20800022);
        val     += GUIFontColor.White + wordText + data.PropertyData.SubmarineAttack + "\n";
        wordText = Globals.Instance.MDataTableManager.GetWordText(20800023);
        val     += GUIFontColor.White + wordText + data.PropertyData.SkillAttack;

        return(val);
    }
Beispiel #16
0
        public override void BindData(object data)
        {
            GirlData girl = data as GirlData;

            this.data = girl;

            weaponLauncher.Bind(this);

            skillLauncher.Bind(this);

            Flip();
        }
    void InitActor()
    {
        PlayerData actorData = Globals.Instance.MGameDataManager.MActorData;

        GirlData wsData = actorData.GetActorFakeWarshipData();

        if (null != wsData)
        {
            actor.UpdateSlot(wsData);
        }
        else
        {
            actor.UpdateAvatarIcon("");
        }
        actor.IsNeedDynamicAdjustColl = true;         // up and down circle

        TagMaskDefine.SetTagRecuisively(actor.gameObject, TagMaskDefine.GFAN_ACTOR);

        // Add move controller
        actor.MoveCtl = actor.gameObject.GetComponent <ObjMoveControl>() as ObjMoveControl;;
        if (null == actor.MoveCtl)
        {
            actor.MoveCtl = actor.gameObject.AddComponent <ObjMoveControl>() as ObjMoveControl;
        }
        actor.MoveCtl.MoveSpeed = moveSpeed;

        //add rigid body
        Rigidbody rigidbody = actor.gameObject.AddComponent <Rigidbody>() as Rigidbody;

        if (rigidbody)
        {
            rigidbody.useGravity  = false;
            rigidbody.isKinematic = true;
        }

        BoxCollider coll = actor.gameObject.GetComponent <BoxCollider>() as BoxCollider;

        if (null == coll)
        {
            coll = actor.gameObject.AddComponent <BoxCollider>() as BoxCollider;
        }
        if (coll)
        {
            coll.isTrigger = true;
            coll.center    = new Vector3(0, 0, 0);
            coll.size      = actor.eventBtn.GetComponent <Collider>().bounds.size;
        }

        actorStartPoint = actor.transform.position;
    }
Beispiel #18
0
    public void UpdateShipInfo(WarshipL ship)
    {
        GirlData data = ship.GirlData;

        if (null == data)
        {
            return;
        }

        SetShipInfoVisible(true);
        SetWarshipLife(ship.GirlData.PropertyData.Life, ship.GirlData.PropertyData.MaxLife);
        SetWarshipDander(ship.GirlData.PropertyData.Power, ship.GirlData.PropertyData.MaxPower);
        SetSkillInfo(data);
    }
Beispiel #19
0
    public void UpdateSlot(GirlData data)
    {
        // Vertical text, so don't use [#FFFFFFFF]
//		Color col = GUIFontColor.ConvertColor(GirlBasicData.GetDisplayColor(data.BasicData.RarityLevel));
//		nameText.Text = data.BasicData.Name;
//		nameText.SetColor(col);

//		string icon = data.BasicData.Icon.Replace("Avatar", "");
//		icon = "Big" + icon;
//		portaitIcon.PlayAnim(icon);
//		pinzhiIcon.PlayAnim(PinzhiIconNames[data.BasicData.RarityLevel - 1]);

        UpdateSkillData(data);
    }
Beispiel #20
0
    //------------------------------------------------------------
    #endregion

    public WarshipL(GirlData data)
    {
        if (null != data)
        {
            _mData = data;

            _warshipID = data.roleCardId;
//			_warshipID = data.WarShipID;
//			_warshipLogicID = data.BasicData.LogicID;
//			_warshipResourceName = data.BasicData.ModelName;
        }


        _mAnimationController = null;
    }
Beispiel #21
0
        private void ShowWeapons()
        {
            weaponItems = new List <WeaponItemRenderer>();

            GirlData girl = UserManager.GetInstance().user.girl;

            foreach (WeaponData weapon in girl.weapons)
            {
                WeaponItemRenderer itemRenderer = ResourceUtils.GetComponent <WeaponItemRenderer>(WeaponItemRenderer.PREFAB_PATH);
                itemRenderer.Initialize(weapon);
                itemRenderer.transform.SetParent(weaponGrid.transform);
                weaponItems.Add(itemRenderer);
            }

            weaponGrid.Reposition();
        }
    void UpdatePropInfo(GirlData data)
    {
        attackText.Text = Globals.Instance.MDataTableManager.GetWordText(11030001)
                          + data.PropertyData.SeaAttack.ToString();
        defenseText.Text = Globals.Instance.MDataTableManager.GetWordText(11030002)
                           + data.PropertyData.Defense.ToString();
        lifeText.Text = Globals.Instance.MDataTableManager.GetWordText(11030003)
                        + data.PropertyData.MaxLife.ToString();

        rangeText.Text = Globals.Instance.MDataTableManager.GetWordText(11030004)
                         + (data.PropertyData.FillSpeed).ToString();
        hitText.Text = Globals.Instance.MDataTableManager.GetWordText(11030005)
                       + (data.PropertyData.HitRate / 100).ToString();
        dodgeText.Text = Globals.Instance.MDataTableManager.GetWordText(11030006)
                         + (data.PropertyData.DodgeRate / 100).ToString();
        critText.Text = Globals.Instance.MDataTableManager.GetWordText(11030007)
                        + (data.PropertyData.CritRate / 100).ToString();
    }
Beispiel #23
0
    private string GetCaptainText(GirlData data)
    {
        string wordText         = Globals.Instance.MDataTableManager.GetWordText(20800027);
        long   WarshipGeneralID = data.WarshipGeneralID;
        Dictionary <long, GeneralData> dictGeneralData = Globals.Instance.MGameDataManager.MActorData.GetGeneralDataList();
        string WarshipGeneralName = "lsj";

        if (dictGeneralData.ContainsKey(WarshipGeneralID))
        {
            WarshipGeneralName = dictGeneralData[WarshipGeneralID].BasicData.Name;
        }
        else
        {
            WarshipGeneralName = Globals.Instance.MDataTableManager.GetWordText(20800029);
        }
        string val = GUIFontColor.Color10H + wordText + WarshipGeneralName;

        return(val);
    }
    public void UpdateCellData(FormationData.SingleLocation cellData, GirlData shipData)
    {
        singleCellData = cellData;
        eventBtn.Data  = cellData;

        // Lock
        if (null == cellData)
        {
            NGUITools.SetActive(avatarSlot.gameObject, true);
            NGUITools.SetActive(plusIcon.gameObject, false);
            NGUITools.SetActive(eyePropText.transform.parent.gameObject, false);
        }
        else
        {
            if (cellData.isArrayEye)
            {
                NGUITools.SetActive(eyePropText.transform.parent.gameObject, true);
                SetEyeBuffData(cellData);
            }
            else
            {
                NGUITools.SetActive(eyePropText.transform.parent.gameObject, false);
            }

            warshipData = shipData;
            if (null != shipData)
            {
                NGUITools.SetActive(avatarSlot.gameObject, false);
                avatarSlot.UpdateSlot(shipData);

                // Specific setting, unify the UIButton event with its parent
                avatarSlot.eventBtn.Data = cellData;

                NGUITools.SetActive(plusIcon.gameObject, false);
            }
            else
            {
                NGUITools.SetActive(avatarSlot.gameObject, true);
                NGUITools.SetActive(plusIcon.gameObject, true);
            }
        }
    }
Beispiel #25
0
    bool IsInBattleFormation(GirlData data)
    {
        bool       isFind    = false;
        PlayerData actorData = Globals.Instance.MGameDataManager.MActorData;

        GameData.FormationData fmtData = null;
        if (actorData.MHoldFormationDataList.TryGetValue(actorData.currSelectFormationID, out fmtData))
        {
            foreach (int shipId in fmtData._dictFormationLocationShip.Values)
            {
                if (shipId == data.roleCardId)
                {
                    isFind = true;
                    break;
                }
            }
        }

        return(isFind);
    }
Beispiel #26
0
    public void UpdateCellShipData(GirlData shipData)
    {
        if (null != fmtEyeIcon)
        {
            fmtEyeIcon.transform.localScale = Vector3.zero;
        }
        if (null != eyePropText)
        {
            eyePropText.transform.localScale = Vector3.zero;
        }

        ShipData = shipData;
        if (null != shipData)
        {
            if (Property.WarshipIsNpc)
            {
                actorAvatarSlot.Hide(true, false);

                npcAvatarSlot.Hide(false, false);
                animComponent = npcAvatarSlot.GetComponent <Animation>() as Animation;
                npcAvatarSlot.UpdateSlot(shipData);
            }
            else
            {
                npcAvatarSlot.Hide(true, false);

                actorAvatarSlot.Hide(false, false);
                animComponent = actorAvatarSlot.GetComponent <Animation>() as Animation;
                actorAvatarSlot.UpdateSlot(shipData);
            }
        }
        else
        {
            actorAvatarSlot.Hide(true, false);
            npcAvatarSlot.Hide(true, false);

            progressBG.transform.localScale    = Vector3.one;
            lifeProgress.transform.localScale  = Vector3.one;
            powerProgress.transform.localScale = Vector3.one;
        }
    }
Beispiel #27
0
    void UpdateSkillData(GirlData data)
    {
        if (-1 == data.WarshipGeneralID)
        {
            skillIcon.transform.localScale = Vector3.one;
        }
        else
        {
            skillIcon.transform.localScale = Vector3.zero;

            GeneralData glData = Globals.Instance.MGameDataManager.MActorData.GetGeneralData(data.WarshipGeneralID);
            if (null != glData)
            {
                foreach (SkillData skillData in glData.SkillDatas.Values)
                {
                    skillIcon.PlayAnim(skillData.BasicData.SkillIcon);
                    break;
                }
            }
        }
    }
    public void UpdateFullInfo(GirlData data)
    {
        if (null == data)
        {
            return;
        }

//		nameText.Text = data.GetDisplayName();
        //pingzhiText.Text = data.BasicData.GetDisplayQualityName();

        string szFormat = Globals.Instance.MDataTableManager.GetWordText(23700020);

        levelText.Text = string.Format(szFormat, data.PropertyData.Level);

        string evoltStr = string.Format(Globals.Instance.MDataTableManager.GetWordText(29000000), data.XiakeEvolutionLevel);

        if (jinHuaText != null)
        {
            jinHuaText.Text = evoltStr;
        }
    }
Beispiel #29
0
    public void UpdateData(WarshipL ship)
    {
        // Update buff information
        _mCurrentWarShip = ship;

        GirlData data = _mCurrentWarShip.GirlData;

        if (null == data)
        {
            return;
        }

        _mShipInfoRoot.gameObject.SetActiveRecursively(true);
//		SetWarshipName(data.BasicData.Name);
        SetWarshipLife(data.PropertyData.Life, data.PropertyData.MaxLife);
        SetWarshipDander(data.PropertyData.Power, data.PropertyData.MaxPower);

        // Check skill
        SetSkillInfo(data);

        UpdateBuffData(ship);
    }
Beispiel #30
0
    void SetSkillInfo(GirlData data)
    {
        // Check skill
        _mSkillBtn.gameObject.SetActiveRecursively(false);
//		if (data.BasicData.IsNpc)
//		{
//			SkillConfig config = Globals.Instance.MDataTableManager.GetConfig<SkillConfig>();
//			SkillConfig.SkillObject element = null;
//			bool hasData = config.GetSkillObject(data.BasicData.NpcSkillID, out element);
//			if (!hasData)
//			{
//				return;
//			}
//
//			_mSkillBtn.gameObject.SetActiveRecursively(true);
//			_mSkillIcon.PlayAnim(element.SkillIconID);
//			string wordText = Globals.Instance.MDataTableManager.GetWordText(element.SkillDescID);
//			_mSkillBtn.Data = wordText;
//
//			_mDescriptionText.gameObject.SetActiveRecursively(false);
//		}
//		else
//		{
//			if (data.HasGeneral)
//			{
//				GeneralData glData = Globals.Instance.MGameDataManager.MActorData.GetGeneralData(data.WarshipGeneralID);
//				foreach (SkillData skillData in glData.SkillDatas.Values)
//				{
//					_mSkillBtn.gameObject.SetActiveRecursively(true);
//					_mSkillIcon.PlayAnim(skillData.BasicData.SkillIcon);
//					_mSkillBtn.Data = skillData.BasicData.SkillDesc;
//					break;
//				}
//			}
//		}
    }
Beispiel #31
0
    /**
     * tzz added
     * fill enemy player data by BattleResult it has been used by NetReceiver.cs and TeachFirstEnterGame.cs
     *
     * @param newBattleResult		battle result data
     */
    public void FillEnemyPlayerData(GameData.BattleGameData.BattleResult newBattleResult)
    {
        if (MActorData == null || MEnemyData == null)
        {
            throw new System.Exception("MActorData == null || MEnemyData == null");
        }

        // Fill in enemy PlayerData
        PlayerData playerData = null;

        foreach (GameData.BattleGameData.Fleet fleetData in newBattleResult.Fleets)
        {
            // by lsj
            if (newBattleResult.BattleType == GameData.BattleGameData.BattleType.PORT_VIE_BATTLE &&
                Globals.Instance.MPortVieManager.puFlagReverseFleetPosition)
            {
                if (fleetData.IsAttacker)
                {
                    playerData = MEnemyData;
                    playerData.ClearWarshipDatas();
                }
                else
                {
                    playerData = MActorData;
                }
            }
            else
            {
                if (fleetData.IsAttacker)
                {
                    playerData = MActorData;
                }
                else
                {
                    playerData = MEnemyData;
                    playerData.ClearWarshipDatas();
                }
            }

            List <GameData.BattleGameData.Ship> shipDatas = fleetData.Ships;
            foreach (GameData.BattleGameData.Ship shipData in shipDatas)
            {
                GirlData data = playerData.GetGirlData(shipData.ShipID);
                if (null == data)
                {
                    data            = new GirlData();
                    data.roleCardId = shipData.ShipID;
//					data.BasicData.LogicID = shipData.LogicShipID;

                    playerData.AddWarshipData(shipData.ShipID, data);
                }
                else
                {
                    data.roleCardId = shipData.ShipID;
//					data.BasicData.LogicID = shipData.LogicShipID;
                }

                // Is Npc ship
//				data.BasicData.IsNpc = shipData.IsNpc;

//				data.BasicData.Name = shipData.ShipName;
//				data.BasicData.TypeID = (EWarshipTypeID)shipData.TypeID;
//				switch (data.BasicData.TypeID)
//				{
//				case EWarshipTypeID.AIRCRAFT_CARRIER:
//					data.BasicData.Type = EWarshipType.CARRIER;
//					break;
//				case EWarshipTypeID.SURFACE_CRAFT:
//				case EWarshipTypeID.SURFACE_CRAFT_1:
//				case EWarshipTypeID.SURFACE_CRAFT_2:
//				case EWarshipTypeID.SURFACE_CRAFT_3:
//				case EWarshipTypeID.SURFACE_CRAFT_4:
//				case EWarshipTypeID.SURFACE_CRAFT_5:
//				case EWarshipTypeID.SURFACE_CRAFT_6:
//					data.BasicData.Type = EWarshipType.SURFACE_SHIP;
//					break;
//				case EWarshipTypeID.UNDER_WATER_CRAFT:
//					data.BasicData.Type = EWarshipType.SUBMARINE;
//					break;
//				}
//				data.BasicData.FillDataFromConfig();

                data.PropertyData.Life = shipData.InitialCurrentLife;
                //data.PropertyData.MaxLife = shipData.MaxLife;
                data.PropertyData.Power    = 0;
                data.PropertyData.MaxPower = GirlData.MAX_POWSER;
            }
        }
    }