Example #1
0
    private bool CheckEvolveUnit(long _unique_id)
    {
        PacketStructUnit _unit = UserDataAdmin.Instance.SearchChara(_unique_id);

        //リンクしている・されている
        if (_unit.link_info != (uint)CHARALINK_TYPE.CHARALINK_TYPE_NONE)
        {
            return(false);
        }
        //進化先があるか?
        MasterDataParamCharaEvol _masterEvol = MasterDataUtil.GetCharaEvolParamFromCharaID(_unit.id);

        if (_masterEvol == null)
        {
            return(false);
        }

        return(true);
    }
Example #2
0
    /// <summary>
    /// ソートパラメータ設定(ユニット)
    /// </summary>
    /// <param name="_main"></param>
    /// <param name="_mainMaster"></param>
    /// <param name="_sub"></param>
    public void setSortParamUnit(PacketStructUnit _main, MasterDataParamChara _mainMaster, bool bEvolCheck = true)
    {
        unit_id   = _main.id;
        unique_id = _main.unique_id;
        unit      = _main;
        master    = _mainMaster;

        setSortParamUnit(_main, _mainMaster, CharaLinkUtil.GetLinkUnit(_main.link_unique_id));

        party_assign = MainMenuUtil.ChkUnitPartyAssign(_main.unique_id);
        favorite     = MainMenuUtil.ChkFavoritedUnit(_main.unique_id);
        get_time     = (long)_main.get_time;

        if (bEvolCheck)
        {
            MasterDataParamCharaEvol evol = MasterFinder <MasterDataParamCharaEvol> .Instance.SelectFirstWhere(" where unit_id_pre = ? ", _mainMaster.fix_id);

            evolve = (evol != null) ? true : false;
        }
    }
Example #3
0
    /// <summary>
    /// ベース選択で進化条件がそろっているユニットかどうか
    /// </summary>
    /// <param name="_unit"></param>
    /// <returns></returns>
    private bool CheckBaseUnitEvolve(PacketStructUnit _unit)
    {
        MasterDataParamChara _master = MasterFinder <MasterDataParamChara> .Instance.Find((int)_unit.id);

        if (_master == null)
        {
            return(false);
        }
        // レベルチェック
        if (_unit.level != _master.level_max)
        {
            return(false);
        }
        MasterDataParamCharaEvol _masterEvolve = MasterDataUtil.GetCharaEvolParamFromCharaID(_unit.id);

        if (_masterEvolve == null)
        {
            return(false);
        }
        uint blendMoney = _masterEvolve.money;

        if (MainMenuParam.m_BeginnerBoost != null &&
            MainMenuParam.m_BeginnerBoost.boost_build_money != 100
            )
        {
            blendMoney = MasterDataUtil.ConvertBeginnerBoostBuildMoney(ref MainMenuParam.m_BeginnerBoost, blendMoney);
        }
        // 所持金チェック
        if (blendMoney > UserDataAdmin.Instance.m_StructPlayer.have_money)
        {
            return(false);
        }
        PacketStructUnit           tempUnit = m_BaseUnit;
        List <MaterialDataContext> tempList = m_UnitMaterialPanel.MaterialList;

        m_UnitMaterialPanel.MaterialList.Clear();
        bool ret = true;

        m_BaseUnit = _unit;
        long unique_id;

        // 素材チェック
        if (_masterEvolve.unit_id_parts1 != 0)
        {
            unique_id = SearchMaterialUnit(_masterEvolve.unit_id_parts1, 0);
            if (unique_id == 0)
            {
                ret = false;
            }
            m_UnitMaterialPanel.addItem(0, _masterEvolve.unit_id_parts1);
            m_UnitMaterialPanel.MaterialList[0].setUnit(unique_id);
        }
        if (_masterEvolve.unit_id_parts2 != 0)
        {
            unique_id = SearchMaterialUnit(_masterEvolve.unit_id_parts2, 0);
            if (unique_id == 0)
            {
                ret = false;
            }
            m_UnitMaterialPanel.addItem(1, _masterEvolve.unit_id_parts2);
            m_UnitMaterialPanel.MaterialList[1].setUnit(unique_id);
        }
        if (_masterEvolve.unit_id_parts3 != 0)
        {
            if (SearchMaterialUnit(_masterEvolve.unit_id_parts3, 2) == 0)
            {
                ret = false;
            }
        }
        m_BaseUnit = tempUnit;
        m_UnitMaterialPanel.MaterialList.Clear();
        m_UnitMaterialPanel.MaterialList = tempList;

        return(ret);
    }
Example #4
0
    /// <summary>
    /// 進化画面更新
    /// </summary>
    public void updateEvolveStatus(bool bRenew = false, bool bMaterialReset = false)
    {
        if (bRenew)
        {
            //ユニットリスト作成
            makeUnitList();
            //ウインドウ閉じる
            m_ExpandWindow.Close(true);
            m_UnitGrid.changeGridWindowSize(false, (m_ExpandWindow != null) ? m_ExpandWindow.ViewHeightSize : 0);
            //パネルを消す
            m_UnitBGPanel.IsViewPanel = false;
            //ソートボタン有効化
            m_UnitGrid.IsActiveSortButton = true;
            //確認OFF
            m_Validate = false;
        }

        m_BaseUnit = UserDataAdmin.Instance.SearchChara(MainMenuParam.m_EvolveBaseUnitUniqueId);
        if (m_BaseUnit != null)
        {
            m_BaseCharaMaster = MasterFinder <MasterDataParamChara> .Instance.Find((int)m_BaseUnit.id);

            //進化前アイコン
            m_UnitBGPanel.setupBaseUnit(m_BaseCharaMaster, m_BaseUnit);

            m_CharaEvol        = MasterDataUtil.GetCharaEvolParamFromCharaID(m_BaseUnit.id);
            m_AfterCharaMaster = MasterFinder <MasterDataParamChara> .Instance.Find((int)m_CharaEvol.unit_id_after);

            //進化後アイコン
            m_UnitBGPanel.setupEvolveUnit(m_AfterCharaMaster, m_BaseUnit);
            //進化後名前
            m_UnitStatusPanel.setup(m_AfterCharaMaster, m_BaseUnit);

            //素材設定
            {
                //素材表示ON
                UnityUtil.SetObjectEnabledOnce(m_UnitMaterialPanel.gameObject, true);
                m_UnitMaterialPanel.MaterialList.Clear();
                m_UnitMaterialPanel.ObjectList.Clear();
                m_UnitMaterialPanel.PanelColor = Color.clear;
                int _materialCount = 0;
                //進化素材情報設定
                if (m_CharaEvol.unit_id_parts1 != 0)
                {
                    m_UnitMaterialPanel.addItem(_materialCount++, m_CharaEvol.unit_id_parts1, SelectMaterialUnit, true);
                }
                if (m_CharaEvol.unit_id_parts2 != 0)
                {
                    m_UnitMaterialPanel.addItem(_materialCount++, m_CharaEvol.unit_id_parts2, SelectMaterialUnit, true);
                }
                if (m_CharaEvol.unit_id_parts3 != 0)
                {
                    m_UnitMaterialPanel.addItem(_materialCount++, m_CharaEvol.unit_id_parts3, SelectMaterialUnit, true);
                }

                StartCoroutine(WaitSetMaterial());
            }

            //ボタン関連ON
            m_UnitBGPanel.IsViewExecButton   = true;
            m_UnitBGPanel.IsViewReturnButton = true;
            m_UnitBGPanel.ExecButtonImage    = m_ConfirmSprite;

            m_UnitBGPanel.IsActiveExecButton = IsEvolveStart();

            MainMenuHeader.UnderMsgRequest(GameTextUtil.GetText("un82p_description"));
        }
        else
        {
            //表示リセット
            m_UnitBGPanel.Money = 0;
            m_UnitBGPanel.resetBaseUnit();
            m_UnitBGPanel.resetEvolveUnit();
            m_UnitStatusPanel.reset();
            m_UnitMaterialPanel.MaterialList.Clear();

            //
            m_AfterCharaMaster = null;
            if (m_CharaEvol != null)
            {
                UnitIconImageProvider.Instance.Reset(m_CharaEvol.unit_id_parts1);
                UnitIconImageProvider.Instance.Reset(m_CharaEvol.unit_id_parts2);
                UnitIconImageProvider.Instance.Reset(m_CharaEvol.unit_id_parts3);

                m_CharaEvol = null;
            }

            //ボタン関連OFF
            m_UnitBGPanel.IsViewExecButton   = false;
            m_UnitBGPanel.IsViewReturnButton = false;

            if (bMaterialReset)
            {
                UnityUtil.SetObjectEnabledOnce(m_UnitMaterialPanel.gameObject, false);
            }
            else
            {
                StartCoroutine(WaitClearMaterial());
            }

            //ベース選択リスト更新
            updateBaseUnitList();
        }
    }
Example #5
0
    private void setupEvol()
    {
        if (m_bEvolve)
        {
            m_EvolveList.Clear();
            m_UnitEvolvePanel.EvolveList.Clear();

            AndroidBackKeyManager.Instance.DisableBackKey();

            new SerialProcess().Add(
                (System.Action next) =>
            {
                //最初の進化先
                int nextUnitId = (int)m_UnitId;
                MasterDataParamChara _masterAfter = m_MainUnitMaster;
                bool nameView = false;

                //進化先がなくなるまで追加処理
                do
                {
                    MasterDataParamCharaEvol _evolAfter = MasterDataUtil.GetCharaEvolParamFromCharaID((uint)nextUnitId);

                    EvolveInfo evolveInfo   = new EvolveInfo();
                    evolveInfo.charaMaster  = _masterAfter;
                    evolveInfo.evolveMaster = _evolAfter;
                    evolveInfo.charaTexture = null;
                    evolveInfo.nameView     = nameView;
                    m_EvolveList.Add(evolveInfo);
                    nameView = true;

                    nextUnitId = -1;

                    if (_evolAfter != null)
                    {
                        _masterAfter = MasterFinder <MasterDataParamChara> .Instance.Find((int)_evolAfter.unit_id_after);
                        if (_masterAfter != null)
                        {
                            nextUnitId = (int)_evolAfter.unit_id_after;
                        }
                    }

                    //同一キャラがすでにリストに登録されていたら検索をやめる
                    if (nextUnitId != -1 &&
                        checkEvolveCharaID((uint)nextUnitId) == false)
                    {
                        nextUnitId = -1;
                    }
                } while (nextUnitId != -1);

                //ローディング表示開始
                LoadingManager.Instance.RequestLoadingStart(LOADING_TYPE.GUARD);

                next();
            })
            .Add((System.Action next) =>
            {
                AssetBundlerMultiplier multi = AssetBundlerMultiplier.Create();
                for (int i = 0; i < m_EvolveList.Count; i++)
                {
                    int no = i;
                    AssetBundler assetBundler = AssetBundler.Create()
                                                .SetAsUnitTexture(m_EvolveList[i].charaMaster.fix_id,
                                                                  (o) =>
                    {
                        m_EvolveList[no].charaTexture = o.GetTexture2D(TextureWrapMode.Clamp);
                    });
                    multi.Add(assetBundler);
                }
                multi.Load(
                    () =>//Success
                {
                    next();
                },
                    () =>//Error
                {
                    next();
                });
            })
            .Add((System.Action next) =>
            {
                for (int i = 0; i < m_EvolveList.Count; i++)
                {
                    UnitEvolveContext evolveContext = new UnitEvolveContext();
                    evolveContext.setup(m_EvolveList[i].charaMaster, m_EvolveList[i].evolveMaster, m_EvolveList[i].charaTexture, m_EvolveList[i].nameView);
                    evolveContext.DidSelectItem = OnSelectSkillButton;
                    m_UnitEvolvePanel.EvolveList.Add(evolveContext);
                }

                //ローディング表示終了
                LoadingManager.Instance.RequestLoadingFinish(LOADING_TYPE.GUARD);

                AndroidBackKeyManager.Instance.EnableBackKey();

                m_LastUpdateCount = UPDATE_LAYOUT_COUNT;

                next();
            })
            .Flush();
        }

        m_Setup[(int)ToggleType.Evolve] = true;
    }
Example #6
0
    public void setup(MasterDataParamChara _chara, MasterDataParamCharaEvol _evolve = null, Texture2D _charaTexture = null, bool nameView = true)
    {
        charaMaster     = _chara;
        evolMaster      = _evolve;
        charaTexture    = _charaTexture;
        limitOverMaster = MasterFinder <MasterDataLimitOver> .Instance.Find((int)charaMaster.limit_over_type);

        IsViewNamePanel     = nameView;
        IsViewMaterialPanel = false;
        IsViewFloatWindow   = false;
        if (evolMaster != null)
        {
            IsViewMaterialPanel = true;

            MaterialValue = "";
            MaterialList.Clear();
            MaterialLabelX = -190;
            if (evolMaster.unit_id_parts1 != 0)
            {
                addMaterial(evolMaster.unit_id_parts1);
                MaterialLabelX += 64;
            }
            if (evolMaster.unit_id_parts2 != 0)
            {
                addMaterial(evolMaster.unit_id_parts2);
                MaterialLabelX += 64;
            }
            if (evolMaster.unit_id_parts3 != 0)
            {
                addMaterial(evolMaster.unit_id_parts3);
                MaterialLabelX += 64;
            }
            if (evolMaster.unit_id_parts4 != 0)
            {
                addMaterial(evolMaster.unit_id_parts4);
                MaterialLabelX += 64;
            }
        }

        charaOnce = new CharaOnce();
        charaOnce.CharaSetupFromID(
            charaMaster.fix_id,
            (int)charaMaster.level_max,
            (int)0,
            (int)limitOverMaster.limit_over_max,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0
            );

        Level          = string.Format(GameTextUtil.GetText("unit_status16"), charaOnce.m_CharaLevel, charaMaster.level_max);
        Hp             = charaOnce.m_CharaHP.ToString();
        HpPlus         = "";
        Atk            = charaOnce.m_CharaPow.ToString();
        AtkPlus        = "";
        Cost           = charaMaster.party_cost.ToString();
        LimitOver      = string.Format(GameTextUtil.GetText("unit_status16"), limitOverMaster.limit_over_max, limitOverMaster.limit_over_max);
        Charm          = charaOnce.m_CharaCharm.ToString("F1");
        ProfileMessage = charaMaster.detail.ReplaceSpaceTag(29).NoLineBreakTag();
    }
    /// <summary>
    /// 進化画面更新
    /// </summary>
    public void updateEvolveStatus(bool bRenew = false)
    {
        if (bRenew)
        {
            //ユニットリスト作成
            makeUnitList();
            //ウインドウ閉じる
            m_ExpandWindow.Close(true);
            m_UnitGrid.changeGridWindowSize(false, (m_ExpandWindow != null) ? m_ExpandWindow.ViewHeightSize : 0);
            //パネルを消す
            m_UnitBGPanel.IsViewPanel = false;
            //ソートボタン有効化
            m_UnitGrid.IsActiveSortButton = true;
            //確認OFF
            m_Validate = false;
        }

        if (m_UnitListCount <= 0)
        {
            if (m_MaxDialog == null)
            {
                m_MaxDialog = Dialog.Create(DialogType.DialogOK);
                m_MaxDialog.SetDialogTextFromTextkey(DialogTextType.Title, "error_reject_common_title");
                m_MaxDialog.SetDialogTextFromTextkey(DialogTextType.MainText, "unit_list_Unowned");
                m_MaxDialog.SetDialogTextFromTextkey(DialogTextType.OKText, "common_button1");
                m_MaxDialog.SetDialogEvent(DialogButtonEventType.OK, () =>
                {
                    MainMenuManager.Instance.AddSwitchRequest(MAINMENU_SEQ.SEQ_HOME_MENU, false, false);
                });
                m_MaxDialog.DisableCancelButton();
                m_MaxDialog.Show();
            }
        }

        m_BaseUnit = UserDataAdmin.Instance.SearchChara(MainMenuParam.m_EvolveBaseUnitUniqueId);
        if (m_BaseUnit != null)
        {
            m_BaseCharaMaster = MasterFinder <MasterDataParamChara> .Instance.Find((int)m_BaseUnit.id);

            //進化前アイコン
            m_UnitBGPanel.setupBaseUnit(m_BaseCharaMaster, m_BaseUnit);

            m_CharaEvol        = MasterDataUtil.GetCharaEvolParamFromCharaID(m_BaseUnit.id);
            m_AfterCharaMaster = MasterFinder <MasterDataParamChara> .Instance.Find((int)m_CharaEvol.unit_id_after);

            //進化後アイコン
            m_UnitBGPanel.setupEvolveUnit(m_AfterCharaMaster, m_BaseUnit);
            //進化後名前
            m_UnitStatusPanel.setup(m_AfterCharaMaster, m_BaseUnit);

            //ボタン関連ON
            m_UnitBGPanel.IsViewExecButton   = true;
            m_UnitBGPanel.IsViewReturnButton = true;
            m_UnitBGPanel.ExecButtonImage    = m_ConfirmSprite;

            m_UnitBGPanel.IsActiveExecButton = IsEvolveStart();

            //ベース選択後リスト更新
            updateBaseUnitAfterList();

            SetupBlendAfterStatus();
        }
        else
        {
            //表示リセット
            m_UnitBGPanel.Point = 0;
            m_UnitBGPanel.resetBaseUnit();
            m_UnitBGPanel.resetEvolveUnit();
            m_UnitStatusPanel.reset();

            //ボタン関連OFF
            m_UnitBGPanel.IsViewExecButton   = false;
            m_UnitBGPanel.IsViewReturnButton = false;

            //ベース選択リスト更新
            updateBaseUnitList();
        }
    }
Example #8
0
    public void setup(uint unit_id, PacketStructUnit _mainUnit, PacketStructUnit _subUnit, Image Chara, Image Shadow)
    {
        lvMax       = false;
        charaMaster = MasterFinder <MasterDataParamChara> .Instance.Find((int)unit_id);

        m_UnitId   = unit_id;
        m_mainUnit = _mainUnit;
        m_subUnit  = _subUnit;
        CharaOnce charaOnce = setParam();

        if (_mainUnit == null)
        {
            IsExpActive      = false;
            linkButtonEnable = false;
            LinkButtonColor  = Color.gray;
        }
        else
        {
            //-----------------------
            // 次のレベルまでの経験値を算出
            //-----------------------
            int   nNowLevelExp  = CharaUtil.GetStatusValue(charaMaster, (int)_mainUnit.level, CharaUtil.VALUE.EXP);
            int   nNextLevelExp = CharaUtil.GetStatusValue(charaMaster, (int)_mainUnit.level + 1, CharaUtil.VALUE.EXP);
            int   nLevelupExp   = nNextLevelExp - nNowLevelExp;
            int   nNextEXP      = 0;
            float expRatio      = 0.0f;
            if (nLevelupExp > 0)
            {
                nNextEXP = nNextLevelExp - (int)_mainUnit.exp;
                expRatio = (float)(nLevelupExp - nNextEXP) / nLevelupExp;
            }
            NextExp     = nNextEXP;
            ExpRate     = expRatio;
            IsExpActive = true;
        }

        CharaSprite       = Chara.sprite;
        CharaMaterial     = Chara.material;
        ShadowSprite      = Shadow.sprite;
        ShadowMaterial    = Shadow.material;
        CharaSpriteWidth  = CharaSprite.texture.GetUnitTextureWidth();
        CharaSpriteHeight = CharaSprite.texture.GetUnitTextureHeight();

        ProfileMessage = charaMaster.detail.ReplaceSpaceTag(29).NoLineBreakTag();

        IsViewMaterialPanel = false;
        IsViewFloatWindow   = false;
        MasterDataParamCharaEvol _evolAfter = MasterDataUtil.GetCharaEvolParamFromCharaID(unit_id);

        if (_evolAfter != null)
        {
            IsViewMaterialPanel = true;

            MaterialValue = "";
            MaterialList.Clear();
            MaterialLabelX = 108;
            if (_evolAfter.unit_id_parts1 != 0)
            {
                addMaterial(_evolAfter.unit_id_parts1);
                MaterialLabelX += 64;
            }
            if (_evolAfter.unit_id_parts2 != 0)
            {
                addMaterial(_evolAfter.unit_id_parts2);
                MaterialLabelX += 64;
            }
            if (_evolAfter.unit_id_parts3 != 0)
            {
                addMaterial(_evolAfter.unit_id_parts3);
                MaterialLabelX += 64;
            }
            if (_evolAfter.unit_id_parts4 != 0)
            {
                addMaterial(_evolAfter.unit_id_parts4);
                MaterialLabelX += 64;
            }
        }
        ScrollRect srect = GetComponentInChildren <ScrollRect>();

        if (srect != null)
        {
            srect.verticalNormalizedPosition = 1;
        }
    }