Пример #1
0
    private void ShowSuitMatrial(SuitInfo rSuitInfo)
    {
        if (null == rSuitInfo)
        {
            return;
        }
        isMatrialEnough = true;

        Util.SetText(consumeCount, "0");

        BindItemInfo(drawingItem, drawingId, 1);

        Util.ClearChildren(matrialRoot);
        for (var i = 0; i < rSuitInfo.costs.Length; i++)
        {
            var itemId = rSuitInfo.costs[i].itemId;

            var prop = ConfigManager.Get <PropItemInfo>(itemId);
            if (itemId == 1)
            {
                AtlasHelper.SetIcons(consumeIcon, prop.icon);
                var a = rSuitInfo.costs[i].count;
                var b = modulePlayer.coinCount;
                Util.SetText(consumeCount, a.ToString());
                isMatrialEnough    = isMatrialEnough && a <= b;
                consumeCount.color = ColorGroup.GetColor(ColorManagerType.IsMoneyEnough, a <= b);
                continue;
            }

            var t = matrialRoot.AddNewChild(matrialTemp);
            t.SafeSetActive(true);
            BindItemInfo(t, itemId, rSuitInfo.costs[i].count);
        }
    }
Пример #2
0
    public static void Load()
    {
        var croc = new SuitInfo
        {
            Body     = Resources.Load <Sprite>("Croc/body"),
            PawsDown = Resources.Load <Sprite>("Croc/paws_down"),
            PawsUp   = Resources.Load <Sprite>("Croc/paws_up"),
            Tail     = Resources.Load <Sprite>("Croc/tail"),
        };

        var pig = new SuitInfo
        {
            Body     = Resources.Load <Sprite>("Pig/body"),
            PawsDown = Resources.Load <Sprite>("Pig/paws_down"),
            PawsUp   = Resources.Load <Sprite>("Pig/paws_up"),
            Tail     = Resources.Load <Sprite>("Pig/tail"),
        };

        _suits = new Dictionary <SuitType, SuitInfo>()
        {
            { SuitType.None, null },
            { SuitType.Croc, croc },
            { SuitType.Pig, pig },
        };
    }
Пример #3
0
    public void BindDrawingItem(int rDrawingId, SuitInfo rSuitInfo = null)
    {
        drawingId = rDrawingId;
        if (rDrawingId <= 0)
        {
            ShowSuitState(false);
            return;
        }

        ShowSuitState(true);

        if (rSuitInfo == null)
        {
            rSuitInfo = ConfigManager.Find <SuitInfo>(item => item.drawingId == drawingId);
        }
        var suitId = rSuitInfo?.ID ?? 0;

        if (excuteButton.interactable)
        {
            previewSuit.Init(suitId, moduleEquip.GetSuitNumber(suitId) + 1, moduleEquip.IsDressOn(moduleFurnace.currentSublimationItem), true);
        }
        else
        {
            previewSuit.Init(suitId, moduleEquip.GetSuitNumber(suitId), moduleEquip.IsDressOn(moduleFurnace.currentSublimationItem), false);
        }

        ShowSuitMatrial(rSuitInfo);
    }
Пример #4
0
    //添加套装信息
    private void addSuitInfo(List <SuitInfo> infos, string equip_id, int starLevel)
    {
        int suitSid = getEquipSuitSid(equip_id);

        if (suitSid == NOT_SUIT)
        {
            return;
        }

        /* fix bug 2014.10.23
         * 重新匹配一次装备星级,因为之前是5件一起算,如果是混穿,会导致低级品质套装也会算上星级
         * 如果发现品质不是橙色以上,都直接重新把星级重置为0
         */
        starLevel = getEquipQualityId(equip_id) >= QualityType.LEGEND ? starLevel : 0;
        for (int i = 0; i < infos.Count; i++)
        {
            if (infos [i].suitSid == getSuitSidByStarLv(getEquipSuitSid(equip_id), starLevel))
            {
                infos [i].ids.Add(equip_id);
                return;
            }
        }
        SuitInfo info = new SuitInfo(getEquipSuitSid(equip_id), starLevel);

        info.addEquipId(equip_id);
        infos.Add(info);
    }
Пример #5
0
    public static void LoadSuitConfig(AssetBundles.NormalRes data)
    {
        byte[] asset = (data as AssetBundles.BytesRes).m_bytes;
        if (asset == null)
        {
            return;
        }

        TbXmlNode docNode = TbXml.Load(asset).docNode;

        if (docNode == null)
        {
            return;
        }
        List <TbXmlNode> xmlNodeList = docNode.GetNodes("Object/Property");
        int xmlNodeListLength        = xmlNodeList.Count;

        if (xmlNodeListLength < 1)
        {
            return;
        }
        SuitInfo info;

        for (int i = 0; i < xmlNodeList.Count; ++i)
        {
            TbXmlNode node = xmlNodeList[i] as TbXmlNode;
            info         = new SuitInfo();
            info.id      = node.GetIntValue("id");
            info.nameID  = node.GetStringValue("name");
            info.equipId = node.GetStringValue("equiq");
            info.suitAdd = node.GetStringValue("suitadd");
            if (configList.ContainsKey(info.id))
            {
                configList[info.id] = info;
            }
            else
            {
                configList.Add(info.id, info);
            }
        }
        asset = null;
    }
Пример #6
0
    //获得套装对应属性
    private List <SuitAttrChange> getSuitAttrChangeBySuitInfo(SuitInfo info)
    {
        if (info == null)
        {
            return(null);
        }
        SuitSample sample = SuitSampleManager.Instance.getSuitSampleBySid(info.suitSid);

        if (sample == null)
        {
            return(null);
        }
        List <SuitAttrChange> list = new List <SuitAttrChange> ();

        for (int i = 0; i < sample.infos.Length; i++)
        {
            if (sample.infos [i].num <= info.ids.Count)
            {
                list.Add(sample.infos [i]);
            }
        }
        return(list);
    }
Пример #7
0
    /// <summary>
    /// 设置信息
    /// </summary>
    public void SetSuitInfo()
    {
        suit_num = 0;
        if (cur_equip_info.suit <= 0)
        {
            return;
        }
        List <EquipItemInfo> equipList = EquipConfig.GetEquipDataListByPlayerID(player_id);

        for (int i = 0; i < equipList.Count; i++)
        {
            EquipInfo info = EquipConfig.GetEquipInfo(int.Parse(equipList[i].itemID));
            if (info.suit == cur_equip_info.suit)
            {
                suit_num++;
            }
        }
        List <object> listObj   = new List <object>();
        SuitInfo      suit_infp = SuitConfig.GetSuitInfoByID(cur_equip_info.suit);

        if (suit_infp == null)
        {
            return;
        }
        for (int j = 0; j < 4; j++)
        {
            SuitItemInfo suit     = new SuitItemInfo();
            string       descText = string.Format(TextManager.GetPropsString(UtilTools.StringBuilder("suit", suit_infp.id, j + 2)), suit_infp.suitAdd.Split(',')[j]);
            suit.content = descText;

            int active = suit_num > (j + 1) ? 1 : 0;
            suit.active = active;
            listObj.Add(suit);
        }
        panel.suitGrid.AddCustomDataList(listObj);
    }
Пример #8
0
            internal override void LoadFor(ProtoCrewMember kerbal)
            {
                Debug.Log("CustomSuit.LoadFor", "kerbal = " + kerbal);

                if (kerbal == null)
                {
                    return;
                }

                Info.hash = "";
                int?   useChance  = null;
                string collection = "";

                for (int i = 0; i < SuitInfo.DataBase?.Count; i++)
                {
                    SuitInfo info = (SuitInfo)SuitInfo.DataBase[i].GetFor(kerbal);

                    Debug.Log("CustomSuit.LoadFor", "SuitInfo.DataBase[" + i + "] = " + info);
                    if (info != null)
                    {
                        Type type = Type.IVA;
                        if (eva != null)
                        {
                            type = Type.EVA;
                        }
                        else if (kerbal is CrewMember && (kerbal as CrewMember)?.activity == 0)
                        {
                            type = Type.EVA;
                        }

                        Debug.Log("CustomSuit.LoadFor", "Matching suit type = " + info.type + " to current activity = " + type);
                        if (info.type != null && info.type != type)
                        {
                            continue;
                        }

                        bool useSuit = true;
                        if (info.situation != null || info.breathable != null || info.suitMinPressure != null || info.suitMaxPressure != null)
                        {
                            useSuit = false;
                            if (eva != null)
                            {
                                Debug.Log("CustomSuit.LoadFor", "Matching " + (info?.situation?.Length ?? 0) + " situation(s) to kerbal situation = " + situation);
                                if (info.situation == null || info.situation.Contains(situation))
                                {
                                    Debug.Log("CustomSuit.LoadFor", "Matching atmosphereContainsOxygen = " + eva?.vessel?.mainBody?.atmosphereContainsOxygen + " to suit breathable = " + info.breathable);
                                    if (info.breathable == null || info.breathable == eva?.vessel?.mainBody?.atmosphereContainsOxygen)
                                    {
                                        double pressure = FlightGlobals.getStaticPressure();
                                        useSuit = !(pressure < info.suitMinPressure) && !(pressure > info.suitMaxPressure);
                                        Debug.Log("CustomSuit.LoadFor", "Matching suitMinPressure = " + info.suitMinPressure + ", suitMaxPressure = " + info.suitMaxPressure + " to current atmospheric pressure = " + pressure + ". useSuit = " + useSuit);
                                    }
                                }
                            }
                        }

                        Debug.Log("CustomSuit.LoadFor", "Matching suit collection = " + info.collection + " to current collection = " + collection);
                        if (string.IsNullOrEmpty(collection) || collection == info.collection)
                        {
                            if (useChance == null && info.useChance != 1)
                            {
                                useChance = kerbal.Hash(info.useGameSeed) % 100;
                            }

                            Debug.Log("CustomSuit.LoadFor", "Matching suit useChance = " + info.useChance + " to generated chance = " + useChance + " %");
                            if (info.useChance == 1 || useChance < info.useChance * 100)
                            {
                                Debug.Log("CustomSuit.LoadFor", "Loading SuitInfo.DataBase[" + i + "]");

                                // Collection
                                collection = info.collection;

                                // Suit Specific Requirements
                                if (useSuit)
                                {
                                    helmetLowPressure  = helmetLowPressure ?? info.helmetLowPressure;
                                    helmetHighPressure = helmetHighPressure ?? info.helmetHighPressure;
                                    helmetDelay        = helmetDelay ?? info.helmetDelay;
                                }
                                jetpackMaxGravity = jetpackMaxGravity ?? info.jetpackMaxGravity;

                                // Colors
                                if (useSuit)
                                {
                                    body     = body ?? info.body.Pick(kerbal, info.useGameSeed);
                                    neckRing = neckRing ?? info.neckRing.Pick(kerbal, info.useGameSeed);
                                    helmet   = helmet ?? info.helmet.Pick(kerbal, info.useGameSeed);
                                    visor    = visor ?? info.visor.Pick(kerbal, info.useGameSeed);
                                    flares   = flares ?? info.flares.Pick(kerbal, info.useGameSeed);
                                    light    = light ?? info.light.Pick(kerbal, info.useGameSeed);
                                }
                                jetpack   = jetpack ?? info.jetpack.Pick(kerbal, info.useGameSeed);
                                parachute = parachute ?? info.parachute.Pick(kerbal, info.useGameSeed);
                                canopy    = canopy ?? info.canopy.Pick(kerbal, info.useGameSeed);
                                backpack  = backpack ?? info.backpack.Pick(kerbal, info.useGameSeed);
                                flag      = flag ?? info.flag.Pick(kerbal, info.useGameSeed);
                                gasjets   = gasjets ?? info.gasjets.Pick(kerbal, info.useGameSeed);
                                headset   = headset ?? info.headset.Pick(kerbal, info.useGameSeed);
                                mug       = mug ?? info.mug.Pick(kerbal, info.useGameSeed);
                                glasses   = glasses ?? info.glasses.Pick(kerbal, info.useGameSeed);
                                backdrop  = backdrop ?? info.backdrop.Pick(kerbal, info.useGameSeed);

                                // Textures
                                if (useSuit)
                                {
                                    bodyTex     = bodyTex ?? info.bodyTex.Pick(kerbal, info.useGameSeed);
                                    neckRingTex = neckRingTex ?? info.neckRingTex.At(bodyTex, info.bodyTex, kerbal, info.useGameSeed);
                                    helmetTex   = helmetTex ?? info.helmetTex.At(bodyTex, info.bodyTex, kerbal, info.useGameSeed);
                                    visorTex    = visorTex ?? info.visorTex.Pick(kerbal, info.useGameSeed);
                                    flaresTex   = flaresTex ?? info.flaresTex.Pick(kerbal, info.useGameSeed);
                                }
                                jetpackTex   = jetpackTex ?? info.jetpackTex.Pick(kerbal, info.useGameSeed);
                                parachuteTex = parachuteTex ?? info.parachuteTex.Pick(kerbal, info.useGameSeed);
                                canopyTex    = canopyTex ?? info.canopyTex.Pick(kerbal, info.useGameSeed);
                                backpackTex  = backpackTex ?? info.backpackTex.Pick(kerbal, info.useGameSeed);
                                flagTex      = flagTex ?? info.flagTex.Pick(kerbal, info.useGameSeed);
                                gasjetsTex   = gasjetsTex ?? info.gasjetsTex.Pick(kerbal, info.useGameSeed);
                                headsetTex   = headsetTex ?? info.headsetTex.Pick(kerbal, info.useGameSeed);
                                mugTex       = mugTex ?? info.mugTex.Pick(kerbal, info.useGameSeed);
                                glassesTex   = glassesTex ?? info.glassesTex.Pick(kerbal, info.useGameSeed);
                                backdropTex  = backdropTex ?? info.backdropTex.Pick(kerbal, info.useGameSeed);

                                // Normals
                                if (useSuit)
                                {
                                    bodyNrm     = bodyNrm ?? info.bodyNrm.At(bodyTex, info.bodyTex, kerbal, info.useGameSeed);
                                    neckRingNrm = neckRingNrm ?? info.neckRingNrm.At(neckRingTex, info.neckRingTex, kerbal, info.useGameSeed);
                                    helmetNrm   = helmetNrm ?? info.helmetNrm.At(helmetTex, info.helmetTex, kerbal, info.useGameSeed);
                                    visorNrm    = visorNrm ?? info.visorNrm.At(visorTex, info.visorTex, kerbal, info.useGameSeed);
                                }
                                jetpackNrm   = jetpackNrm ?? info.jetpackNrm.At(jetpackTex, info.jetpackTex, kerbal, info.useGameSeed);
                                parachuteNrm = parachuteNrm ?? info.parachuteNrm.At(parachuteTex, info.parachuteTex, kerbal, info.useGameSeed);
                                canopyNrm    = canopyNrm ?? info.canopyNrm.At(canopyTex, info.canopyTex, kerbal, info.useGameSeed);
                                backpackNrm  = backpackNrm ?? info.backpackNrm.At(backpackTex, info.backpackTex, kerbal, info.useGameSeed);
                                flagNrm      = flagNrm ?? info.flagNrm.At(flagTex, info.flagTex, kerbal, info.useGameSeed);
                                headsetNrm   = headsetNrm ?? info.headsetNrm.At(headsetTex, info.headsetTex, kerbal, info.useGameSeed);
                                mugNrm       = mugNrm ?? info.mugNrm.At(mugTex, info.mugTex, kerbal, info.useGameSeed);
                                glassesNrm   = glassesNrm ?? info.glassesNrm.At(glassesTex, info.glassesTex, kerbal, info.useGameSeed);
                                backdropNrm  = backdropNrm ?? info.backdropNrm.At(backdropTex, info.backdropTex, kerbal, info.useGameSeed);

                                continue;
                            }
                        }
                    }

                    Debug.Log("CustomSuit.LoadFor", "Ignoring SuitInfo.DataBase[" + i + "]");
                }

                helmetTime = helmetDelay ?? 1;
            }