/// <summary>
    /// 属性提升成功
    /// </summary>
    /// <param name="ret"></param>
    private void OnPromoteComplete(bool success)
    {
        bool clearRs = true;

        GameCmd.PairNumber selectAttrPair = GetEquipAttrByIndex((int)m_em_selectEquipAttrIndex);
        if (null != selectAttrPair)
        {
            //筛选满足条件符石
            uint selectAttrGrade = emgr.GetAttrGrade(selectAttrPair);

            if (m_uint_selectRSBaseId != 0)
            {
                RuneStone rs = DataManager.Manager <ItemManager>()
                               .GetTempBaseItemByBaseID <RuneStone>(m_uint_selectRSBaseId, ItemDefine.ItemDataType.RuneStone);
                int holdNum = imgr.GetItemNumByBaseId(m_uint_selectRSBaseId);
                clearRs = rs.Grade < selectAttrGrade || holdNum <= 0;
            }
        }
        ResetProccess(clearIndex: false, clearSelectRsId: clearRs);
        string tips = "恭喜,提升属性成功";

        if (!success)
        {
            tips = "很遗憾,属性提升失败";
        }
        UpdateProccess(Data);
        TipsManager.Instance.ShowTips(tips);
    }
Exemple #2
0
    void OnCollisionEnter(Collision collision)
    {
        hitObject = collision.gameObject;
        if (hitObject.CompareTag("RuneStone"))
        {
            fedStone = hitObject.GetComponent <RuneStone>();
            if (fedStone == null)
            {
                Debug.LogError("No RuneStone script found on object tagged as being a RuneStone!");
            }

            if (fedStone.goodStone)
            {
                hangryValue  += nomValue;
                spawnedSplash = Instantiate(splashPrefab, hitObject.transform.position + new Vector3(0, 0.3f, 0), Quaternion.Euler(0, 0, 0));
                var mainSplash = spawnedSplash.GetComponent <ParticleSystem>().main;
                mainSplash.startColor = Color.green;
                splashSound.pitch     = 1.0f;
                splashSound.Play();
            }
            else
            {
                hangryValue  -= badnomValue;
                spawnedSplash = Instantiate(splashPrefab, hitObject.transform.position + new Vector3(0, 0.3f, 0), Quaternion.Euler(0, 0, 0));
                var mainSplash = spawnedSplash.GetComponent <ParticleSystem>().main;
                mainSplash.startColor = Color.red;
                splashSound.pitch     = 0.7f;
                splashSound.Play();
            }
            Destroy(hitObject);
        }
    }
Exemple #3
0
    /// <summary>
    /// 设置格子
    /// </summary>
    /// <param name="attr">属性</param>
    /// <param name="totalProtectAttrNum">保护属性总条数</param>
    /// <param name="selectNum">选择数量</param>
    /// <param name="callback"></param>
    public void SetGridView(GameCmd.PairNumber attr, bool select, int fillNum = 0, int needNum = 0
                            , Action <uint> callback = null)
    {
        ResetInfoGrid();
        RuneStone rs = null;
        uint      runeStoneBaseId = 0;

        AttrId = attr.id;
        EquipManager emgr = DataManager.Manager <EquipManager>();

        if (emgr.TryGetRuneStoneIdByEffectId(emgr.TransformAttrToEffectId(attr), out runeStoneBaseId))
        {
            rs = DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <RuneStone>(runeStoneBaseId, ItemDefine.ItemDataType.RuneStone);
        }
        else
        {
            Engine.Utility.Log.Error("TryGetRuneStoneIdByEffectId failed attr pair = [id,{0}]-[value,{1}]", attr.id, attr.value);
        }
        m_uint_rsId = rs.BaseId;
        if (null != this.attrDes)
        {
            this.attrDes.text = emgr.GetAttrDes(attr);
        }

        if (null != this.m_labPortectDes)
        {
            this.m_labPortectDes.text = string.Format("消耗符石档次:{0}档", rs.Grade);
        }
        if (null != m_toggle)
        {
            m_toggle.value = select;
        }
        SetIcon(true, rs.Icon);
        SetBorder(true, rs.BorderIcon);
        int holdNum = (int)DataManager.Manager <ItemManager>().GetItemNumByBaseId(runeStoneBaseId);

        SetRuneStoneMask(true, (uint)rs.Grade);
        if (select && fillNum < needNum)
        {
            SetNotEnoughGet(true);
        }
        if (null != m_labNum)
        {
            if (select)
            {
                this.m_labNum.text = ItemDefine.BuilderStringByHoldAndNeedNum((uint)fillNum, (uint)needNum);
            }
            else
            {
                this.m_labNum.text = holdNum.ToString();
            }
        }

        if (this.changeCallback != callback)
        {
            this.changeCallback = callback;
        }
    }
Exemple #4
0
            public static string GetHoverText(string __result, RuneStone __instance)
            {
                if (m_SkaldRunestoneTexts.ContainsKey(__instance.name))
                {
                    return((__result ?? "") + Localization.instance.Localize($"\n[<color=yellow><b>{readMoreModifierKey.Value} + $KEY_Use</b></color>] ") + m_localization.TryTranslate("skald_piece_rune_read_more"));
                }

                return(__result);
            }
    /// <summary>
    /// 更新消除
    /// </summary>
    internal void UpdateRemove()
    {
        bool      isSelectRS = (m_uint_selectRSBaseId != 0);
        RuneStone rs         = DataManager.Manager <ItemManager>()
                               .GetTempBaseItemByBaseID <RuneStone>(m_uint_selectRSBaseId, ItemDefine.ItemDataType.RuneStone);
        uint num = (isSelectRS) ? (uint)imgr.GetItemNumByBaseId(m_uint_selectRSBaseId) : 0;

        if (null != m_processRsGrowShow)
        {
            m_processRsGrowShow.SetGridData(m_uint_selectRSBaseId, needUnload: true);
        }
        int attrCount = GetEquipAttrCount(false);

        if (attrCount > 0)
        {
            EquipDefine.LocalAttrData attr     = null;
            GameCmd.PairNumber        attrPair = null;
            ColorType cType  = ColorType.JZRY_Txt_Black;
            bool      choose = false;
            for (ForgingProccessPropertyIndex i = ForgingProccessPropertyIndex.One;
                 i < (ForgingProccessPropertyIndex)attrCount; i++)
            {
                choose   = IsSelectEquipAttr() && (m_em_selectEquipAttrIndex == i);
                cType    = (choose) ? ColorType.JZRY_Txt_Red : ColorType.JZRY_Txt_Black;
                attrPair = GetEquipAttrByIndex((int)i, true);
                if (m_dic_propCurGrids.ContainsKey(i) && !m_dic_propCurGrids[i].Visible)
                {
                    m_dic_propCurGrids[i].SetVisible(true);
                    attr = EquipDefine.LocalAttrData.Create(attrPair);
                    m_dic_propCurGrids[i].SetGridView(ColorManager.GetColorString(cType, attr.AttrDes), attr.IsMaxGrade, true
                                                      , attr.Grade);
                }

                if (m_dic_propCBs.ContainsKey(i) && !m_dic_propCBs[i].gameObject.activeSelf)
                {
                    m_dic_propCBs[i].gameObject.SetActive(true);
                    m_dic_propCBs[i].Set(choose);
                }

                bool showTips = emgr.IsItemHaveAdditiveAttrOrGemHole(selectEquipId);
                if (null != m_label_ProccessTips && m_label_ProccessTips.gameObject.activeSelf != showTips)
                {
                    m_label_ProccessTips.gameObject.SetActive(showTips);
                    if (showTips)
                    {
                        m_label_ProccessTips.text = "勾选属性消除后消失";
                    }
                }
            }
        }
    }
 private void GeneratePrimaryRuneChoices(RuneStone rs, string pathName)
 {
     individualRuneChoicesGameObjects = new List <GameObject>();
     foreach (string NameOfruneChoice in rs.stoneChoices)
     {
         GameObject runeChoiceGameObject = GameObjectUtility.CustomInstantiate(individualRuneChoice, this.transform);
         individualRuneChoicesGameObjects.Add(runeChoiceGameObject);
         runeChoiceGameObject.GetComponent <IndividualRuneChoice>().Initialize(NameOfruneChoice, this.gameObject, pathName);
         if (NameOfruneChoice.Equals(rs.stoneChoiced))
         {
             runeChoiceGameObject.GetComponent <IndividualRuneChoice>().HandleClick();
         }
     }
 }
    public void Initialize(RuneStone runeStone, string pathName)
    {
        this.pathName       = pathName;
        this.runeStone      = runeStone;
        strSelectedRuneName = runeStone.stoneChoiced;
        isPrimary           = true;
        GetComponent <Button>().GetComponentInChildren <Text>().text = runeStone.strName;
        GeneratePrimaryRuneChoices(runeStone, pathName);

        Button btn = GetComponent <Button>();

        btn.onClick.RemoveAllListeners();
        btn.onClick.AddListener(() => { Deselect(); });
    }
Exemple #8
0
            public static bool Interact(ref RuneStone __instance)
            {
                if (!(
                        Input.GetKey(readMoreModifierKey.Value) &&
                        m_SkaldRunestoneTexts.ContainsKey(__instance.name)
                        ))
                {
                    return(true);
                }

                RuneStone.RandomRuneText randomText = m_SkaldRunestoneTexts[__instance.name][rng.Next(m_SkaldRunestoneTexts[__instance.name].Count)];

                TextViewer.instance.ShowText(TextViewer.Style.Rune, m_localization.TryTranslate("skald_runestone_topic"), randomText.m_text, autoHide: true);

                return(false);
            }
Exemple #9
0
        public static void Postfix(RuneStone __instance, Humanoid character)
        {
            Debug.Log("Runestone interaction");
            Player player = character as Player;

            if (__instance == null || player == null || RuneDB.Instance.AllRunes == null)
            {
                return;
            }
            MethodInfo methodInfo = typeof(RuneStone).GetMethod("GetRandomText", BindingFlags.NonPublic | BindingFlags.Instance);

            RuneStone.RandomRuneText runeText = (RuneStone.RandomRuneText)methodInfo.Invoke(__instance, null);
            if (runeText != null && runeTokenRegex.IsMatch(runeText.m_text))
            {
                var matchInfo = runeTokenRegex.Match(runeText.m_text);
                runeText.m_label = $"Rune Lore: {char.ToUpper(matchInfo.Groups[1].Value[0])}{matchInfo.Groups[1].Value.Substring(1)} {Int32.Parse(matchInfo.Groups[2].Value)}";
                player.AddKnownText(runeText.m_label, runeText.m_text);
                typeof(Player).GetMethod("UpdateKnownRecipesList", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(player, null);
            }
        }
    /// <summary>
    /// 更新提取
    /// </summary>
    internal void UpdateFetch()
    {
        RuneStone rs = DataManager.Manager <ItemManager>()
                       .GetTempBaseItemByBaseID <RuneStone>(emgr.InactiveRuneStoneBaseId, ItemDefine.ItemDataType.RuneStone);
        uint num = (uint)imgr.GetItemNumByBaseId(emgr.InactiveRuneStoneBaseId);

        if (null != m_processRsGrowShow)
        {
            m_processRsGrowShow.SetGridData(rs.BaseId);
        }
        int attrCount = GetEquipAttrCount(true);

        if (attrCount > 0)
        {
            EquipDefine.LocalAttrData attr     = null;
            GameCmd.PairNumber        attrPair = null;
            for (ForgingProccessPropertyIndex i = ForgingProccessPropertyIndex.One
                 ; i < (ForgingProccessPropertyIndex)attrCount; i++)
            {
                attrPair = GetEquipAttrByIndex((int)i, true);
                if (m_dic_propCurGrids.ContainsKey(i) && !m_dic_propCurGrids[i].Visible)
                {
                    m_dic_propCurGrids[i].SetVisible(true);
                    attr = EquipDefine.LocalAttrData.Create(attrPair);
                    m_dic_propCurGrids[i].SetGridView(ColorManager.GetColorString(ColorType.JZRY_Txt_Black, attr.AttrDes), attr.IsMaxGrade, true
                                                      , attr.Grade);
                }
            }
            bool showTips = emgr.IsItemHaveAdditiveAttrOrGemHole(selectEquipId);
            if (null != m_label_ProccessTips && m_label_ProccessTips.gameObject.activeSelf != showTips)
            {
                m_label_ProccessTips.gameObject.SetActive(showTips);
                if (showTips)
                {
                    m_label_ProccessTips.text = "提取后此装备消失";
                }
            }
        }
    }
    protected override void OnShow(object data)
    {
        base.OnShow(data);
        if (null == data || !(data is uint))
        {
            return;
        }
        m_uint_runeStoneBaseId = (uint)data;
        RuneStone rs = DataManager.Manager <ItemManager>()
                       .GetTempBaseItemByBaseID <RuneStone>(m_uint_runeStoneBaseId, ItemDefine.ItemDataType.RuneStone);

        if (null != m_infoGrid)
        {
            m_infoGrid.SetGridData(rs.BaseId);

            if (null != m_label_RsName)
            {
                m_label_RsName.color = Color.white;
                string txtName = ColorManager.GetColorString(ColorType.JZRY_Txt_Black, "恭喜获得:{0}");
                m_label_RsName.text = string.Format(txtName, rs.Name);
            }
        }
    }
    /// <summary>
    /// 刷新加工消费
    /// </summary>
    private void UpdateProccessCost()
    {
        if (null != m_trans_ProccessCost)
        {
            uint proccessCost = 0;
            if (IsProccessMode(ForgingProccessMode.Fetch))
            {
                proccessCost = emgr.RuneStoneActivationCost;
            }
            else
            {
                GameCmd.PairNumber selectAttrPair = GetEquipAttrByIndex((int)m_em_selectEquipAttrIndex);
                if (null != selectAttrPair)
                {
                    uint      matchRunestoneID = emgr.GetMatchAttrRuneStone(selectAttrPair);
                    RuneStone rs = imgr.GetTempBaseItemByBaseID <RuneStone>(matchRunestoneID, ItemDefine.ItemDataType.RuneStone);
                    if (IsProccessMode(ForgingProccessMode.Remove))
                    {
                        proccessCost = (null != rs) ? rs.RemoveCost : 0;
                    }
                    else if (IsProccessMode(ForgingProccessMode.Promote))
                    {
                        proccessCost = (null != rs) ? rs.PromoteCost : 0;
                    }
                }
            }

            UICurrencyGrid currencyGrid = m_trans_ProccessCost.GetComponent <UICurrencyGrid>();
            if (null == currencyGrid)
            {
                currencyGrid = m_trans_ProccessCost.gameObject.AddComponent <UICurrencyGrid>();
            }
            currencyGrid.SetGridData(new UICurrencyGrid.UICurrencyGridData(
                                         MallDefine.GetCurrencyIconNameByType(GameCmd.MoneyType.MoneyType_Gold), proccessCost));
        }
    }
Exemple #13
0
    /// <summary>
    /// 设置格子数据
    /// </summary>
    /// <param name="qwThisId"></param>
    /// <param name="check"></param>
    /// <param name="enable"></param>
    public void SetGridViewData(uint baseId, bool check, bool enable)
    {
        this.baseId = baseId;
        RuneStone baseItem = DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <RuneStone>(baseId, ItemDefine.ItemDataType.RuneStone);

        mbEnable = enable;
        SetHightLight(check);
        if (null != baseItem)
        {
            if (null != m_name)
            {
                m_name.text = baseItem.Name;
            }
            SetIcon(true, baseItem.Icon);
            SetBorder(true, baseItem.BorderIcon);
            SetBindMask(baseItem.IsBind);
            SetRuneStoneMask(true, (uint)baseItem.Grade);
            int holdNum = DataManager.Manager <ItemManager>().GetItemNumByBaseId(baseId);
            if (holdNum > 1)
            {
                SetNum(true, holdNum.ToString());
            }
        }
    }
    /// <summary>
    /// 更新提升
    /// </summary>
    internal void UpdatePromote()
    {
        bool      isSelectRS = (m_uint_selectRSBaseId != 0);
        RuneStone rs         = DataManager.Manager <ItemManager>()
                               .GetTempBaseItemByBaseID <RuneStone>(m_uint_selectRSBaseId, ItemDefine.ItemDataType.RuneStone);
        uint num = (isSelectRS) ? (uint)imgr.GetItemNumByBaseId(m_uint_selectRSBaseId) : 0;

        if (null != m_processRsGrowShow)
        {
            m_processRsGrowShow.SetGridData(m_uint_selectRSBaseId, needUnload: true);
        }
        int attrCount = GetEquipAttrCount();

        if (attrCount > 0)
        {
            EquipDefine.LocalAttrData attr     = null;
            EquipDefine.LocalAttrData nextAttr = null;
            GameCmd.PairNumber        attrPair = null;
            ColorType cType   = ColorType.JZRY_Txt_Black;
            bool      choose  = false;
            Vector3   tempPos = Vector3.zero;
            for (ForgingProccessPropertyIndex i = ForgingProccessPropertyIndex.One;
                 i < (ForgingProccessPropertyIndex)attrCount; i++)
            {
                cType    = ColorType.JZRY_Txt_Black;
                choose   = IsSelectEquipAttr() && (m_em_selectEquipAttrIndex == i);
                attrPair = GetEquipAttrByIndex((int)i);
                attr     = EquipDefine.LocalAttrData.Create(attrPair);
                if (m_dic_propCurGrids.ContainsKey(i))
                {
                    m_dic_propCurGrids[i].SetVisible(true);
                    m_dic_propCurGrids[i].SetGridView(ColorManager.GetColorString(cType, attr.AttrDes), attr.IsMaxGrade, true
                                                      , attr.Grade);
                }

                if (m_dic_propNextGrids.ContainsKey(i))
                {
                    cType = (choose) ? ColorType.JZRY_Green : ColorType.JZRY_Txt_Black;
                    m_dic_propNextGrids[i].SetVisible(true);
                    if (attr.IsMaxGrade)
                    {
                        m_dic_propNextGrids[i].SetGridView("", false, false);
                        m_dic_propNextGrids[i].SetProperty("已提升至最大等级");
                    }
                    else
                    {
                        nextAttr = EquipDefine.LocalAttrData.Create((null != attr) ? attr.NextEffectId : 0);
                        if (null != nextAttr)
                        {
                            m_dic_propNextGrids[i].SetGridView(
                                ColorManager.GetColorString(cType, nextAttr.AttrDes), nextAttr.IsMaxGrade, true, nextAttr.Grade);
                        }
                        else
                        {
                            Engine.Utility.Log.Error("Forgingpanel_proccess UpdatePromote nextAttr null");
                        }
                    }

                    if (null != m_trans_ArrowPromote && choose && isSelectRS)
                    {
                        if (!m_trans_ArrowPromote.gameObject.activeSelf)
                        {
                            m_trans_ArrowPromote.gameObject.SetActive(true);
                        }
                        tempPos   = m_trans_ArrowPromote.position;
                        tempPos.y = m_dic_propCurGrids[i].CacheTransform.position.y;
                        m_trans_ArrowPromote.transform.position = tempPos;
                        if (null != m_label_ArrowPromoteTxt)
                        {
                            uint differ = (null != attr && null != rs) ? (rs.Grade - attr.Grade) : 0;
                            m_label_ArrowPromoteTxt.text = string.Format("成功率{0}%", emgr.GetPropertyPromoteProp(differ));
                        }
                    }
                }

                if (m_dic_propCBs.ContainsKey(i) && !m_dic_propCBs[i].gameObject.activeSelf)
                {
                    m_dic_propCBs[i].gameObject.SetActive(true);
                    m_dic_propCBs[i].Set(choose);
                }
            }
        }
    }
Exemple #15
0
    public void WriteToFile(string filename)
    {
        Debug.Log("Beginning SaveTheGame");
        string path = System.IO.Directory.GetCurrentDirectory();

        using (System.IO.StreamWriter file =
                   new System.IO.StreamWriter(path + filename + ".txt"))
        {
            int      index         = (int)PhotonNetwork.CurrentRoom.CustomProperties["CurrentPlayerIndex"];
            string[] players       = (string[])PhotonNetwork.CurrentRoom.CustomProperties["Players"];
            int      gameSize      = (int)PhotonNetwork.CurrentRoom.CustomProperties["GameSize"];
            int      narratorPos   = (int)PhotonNetwork.CurrentRoom.CustomProperties["NarratorPosition"];
            int      numMonsters   = (int)PhotonNetwork.CurrentRoom.CustomProperties["MonstersAtCastle"];
            int      numFarmers    = (int)PhotonNetwork.CurrentRoom.CustomProperties["FarmersAtCastle"];
            bool     herbsAtCastle = (bool)PhotonNetwork.CurrentRoom.CustomProperties["HerbAtCastle"];
            bool     skralDefeated = (bool)PhotonNetwork.CurrentRoom.CustomProperties["SkralAtCastleDefeated"];
            file.WriteLine(index.ToString());
            file.WriteLine(narratorPos.ToString());
            file.WriteLine(numMonsters.ToString());
            file.WriteLine(numFarmers.ToString());
            file.WriteLine(herbsAtCastle.ToString());
            file.WriteLine(skralDefeated.ToString());
            foreach (Player p in PhotonNetwork.PlayerList)
            {
                string type        = (string)p.CustomProperties["Type"];
                int    pos         = (int)p.CustomProperties["pos"];
                int    hours       = (int)p.CustomProperties["Hours"];
                int    wp          = (int)p.CustomProperties["wp"];
                int    sp          = (int)p.CustomProperties["sp"];
                int    farmer      = (int)p.CustomProperties["farmer"];
                int    gold        = (int)p.CustomProperties["gold"];
                bool   herb        = (bool)p.CustomProperties["herb"];
                int    wineskin    = (int)p.CustomProperties["wineskin"];
                int    shield      = (int)p.CustomProperties["shield"];
                int    falcon      = (int)p.CustomProperties["falcon"];
                int    telescope   = (int)p.CustomProperties["telescope"];
                int    bow         = (int)p.CustomProperties["bow"];
                int    helm        = (int)p.CustomProperties["helm"];
                int    brew        = (int)p.CustomProperties["brew"];
                int    yellowStone = (int)p.CustomProperties["yellowStone"];
                int    blueStone   = (int)p.CustomProperties["blueStone"];
                int    greenStone  = (int)p.CustomProperties["greenStone"];

                string ln = type + "\t" + pos + "\t" + hours + "\t" + wp + "\t" + sp + "\t" + farmer + "\t" + gold + "\t" + herb + "\t" + wineskin + "\t" + shield + "\t" + falcon + "\t" + telescope + "\t" + bow + "\t" + helm + "\t" + brew + "\t" + yellowStone + "\t" + blueStone + "\t" + greenStone;
                file.WriteLine(ln);
            }
            GameObject[] monsters = GameObject.FindGameObjectsWithTag("Monster");
            foreach (GameObject obj in monsters)
            {
                Monster m = obj.GetComponent <Monster>();
                file.WriteLine(m.type + "\t" + m.pos);
            }
            GameObject[] wells = GameObject.FindGameObjectsWithTag("Well");
            foreach (GameObject obj in wells)
            {
                Wells w = obj.GetComponent <Wells>();
                file.WriteLine("well" + "\t" + w.pos + "\t" + w.wellStatus.ToString());
            }
            GameObject[] fogs = GameObject.FindGameObjectsWithTag("Fog");
            foreach (GameObject obj in fogs)
            {
                GameBoardRegion regionWithFog = obj.GetComponent <GameBoardRegion>();
                file.WriteLine("fog" + "\t" + regionWithFog.num);
            }
            string line = "";
            foreach (string f in UnFlippedFog.fogOutcomes)
            {
                line = line + f + "\t";
            }
            file.WriteLine(line);
            GameObject[] golds = GameObject.FindGameObjectsWithTag("GoldToken");
            foreach (GameObject obj in golds)
            {
                GoldToken g = obj.GetComponent <GoldToken>();
                file.WriteLine("gold" + "\t" + g.pos + "\t" + g.amt);
            }
            GameObject[] yellow = GameObject.FindGameObjectsWithTag("RuneStoneYellow");
            foreach (GameObject obj in yellow)
            {
                RuneStone r = obj.GetComponent <RuneStone>();
                file.WriteLine("yellow" + "\t" + r.pos);
            }
            GameObject[] green = GameObject.FindGameObjectsWithTag("RuneStoneGreen");
            foreach (GameObject obj in green)
            {
                RuneStone r = obj.GetComponent <RuneStone>();
                file.WriteLine("green" + "\t" + r.pos);
            }
            GameObject[] blue = GameObject.FindGameObjectsWithTag("RuneStoneBlue");
            foreach (GameObject obj in blue)
            {
                RuneStone r = obj.GetComponent <RuneStone>();
                file.WriteLine("blue" + "\t" + r.pos);
            }
            GameObject[] farmers = GameObject.FindGameObjectsWithTag("Farmer");
            foreach (GameObject obj in farmers)
            {
                Farmer f = obj.GetComponent <Farmer>();
                file.WriteLine("farmer" + "\t" + f.pos);
            }
            GameObject herbToken = GameObject.Find("Herb");
            if (herbToken == null)
            {
                herbToken = GameObject.Find("Herb(Clone)");
            }
            else
            {
                file.WriteLine("herb" + "\t" + herbToken.GetComponent <HerbController>().pos);
            }
            GameObject witch = GameObject.Find("WitchBrew");
            if (witch == null)
            {
                witch = GameObject.Find("WitchBrew(Clone)");
            }
            else
            {
                file.WriteLine("witch" + "\t" + witch.GetComponent <WitchBrewController>().pos);
            }
            Debug.Log("Closing Stream Writer");

            file.Close();
        }
    }
Exemple #16
0
        private static string GetPrefabFriendlyName(GameObject prefab)
        {
            HoverText hover = prefab.GetComponent <HoverText>();

            if (hover)
            {
                return(hover.m_text);
            }

            ItemDrop item = prefab.GetComponent <ItemDrop>();

            if (item)
            {
                return(item.m_itemData.m_shared.m_name);
            }

            Character chara = prefab.GetComponent <Character>();

            if (chara)
            {
                return(chara.m_name);
            }

            RuneStone runestone = prefab.GetComponent <RuneStone>();

            if (runestone)
            {
                return(runestone.m_name);
            }

            ItemStand itemStand = prefab.GetComponent <ItemStand>();

            if (itemStand)
            {
                return(itemStand.m_name);
            }

            MineRock mineRock = prefab.GetComponent <MineRock>();

            if (mineRock)
            {
                return(mineRock.m_name);
            }

            Pickable pickable = prefab.GetComponent <Pickable>();

            if (pickable)
            {
                return(GetPrefabFriendlyName(pickable.m_itemPrefab));
            }

            CreatureSpawner creatureSpawner = prefab.GetComponent <CreatureSpawner>();

            if (creatureSpawner)
            {
                return(GetPrefabFriendlyName(creatureSpawner.m_creaturePrefab));
            }

            SpawnArea spawnArea = prefab.GetComponent <SpawnArea>();

            if (spawnArea && spawnArea.m_prefabs.Count > 0)
            {
                return(GetPrefabFriendlyName(spawnArea.m_prefabs[0].m_prefab));
            }

            Piece piece = prefab.GetComponent <Piece>();

            if (piece && !string.IsNullOrEmpty(piece.m_name))
            {
                return(piece.m_name);
            }

            return(prefab.name);
        }
    /// <summary>
    /// 点击属性提升符石选择
    /// </summary>
    private void OnSelectProcessRuneStone()
    {
        if (!IsSelectEquipAttr() || DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.ItemChoosePanel))
        {
            TipsManager.Instance.ShowTips("请勾选需要提升的属性");
            return;
        }

        GameCmd.PairNumber selectAttrPair = GetEquipAttrByIndex((int)m_em_selectEquipAttrIndex);
        if (null == selectAttrPair)
        {
            Engine.Utility.Log.Error("Get AttrPair faield,promoteid:{0}", 0);
            return;
        }
        uint selectAttrGrade = emgr.GetAttrGrade(selectAttrPair);
        bool filterEqual     = IsProccessMode(ForgingProccessMode.Promote);
        //筛选满足条件符石
        List <uint> baseIdList = emgr.GetMatchProperyRunestone(selectAttrPair, filterEqual);

        UILabel          desLabel     = null;
        Action <UILabel> desLabAction = (des) =>
        {
            desLabel = des;
            if (null != desLabel)
            {
                if (filterEqual)
                {
                    desLabel.text = m_tmgr.GetLocalText(LocalTextType.Local_TXT_Rune_1);
                }
                else
                {
                    desLabel.text = m_tmgr.GetLocalText(LocalTextType.Local_TXT_Rune_2);
                }
            }
        };
        uint tempSelectGemRuneStoneId             = 0;
        UIRSInfoSelectGrid selectGemRuneStoneGrid = null;
        UIEventDelegate    eventDlg = (eventTye, grid, param) =>
        {
            if (eventTye == UIEventType.Click)
            {
                UIRSInfoSelectGrid tempGrid = grid as UIRSInfoSelectGrid;
                RuneStone          tempRs   = DataManager.Manager <ItemManager>()
                                              .GetTempBaseItemByBaseID <RuneStone>(tempGrid.BaseId, ItemDefine.ItemDataType.RuneStone);
                if (tempSelectGemRuneStoneId == tempGrid.BaseId)
                {
                    tempSelectGemRuneStoneId = 0;
                    tempGrid.SetHightLight(false);
                }
                else if (tempGrid.BaseId != 0)
                {
                    bool enable = (!filterEqual) ? (tempRs.Grade >= selectAttrGrade) : (tempRs.Grade > selectAttrGrade);
                    if (enable)
                    {
                        tempSelectGemRuneStoneId = tempGrid.BaseId;
                        if (null != selectGemRuneStoneGrid)
                        {
                            selectGemRuneStoneGrid.SetHightLight(false);
                        }
                        tempGrid.SetHightLight(true);
                        selectGemRuneStoneGrid = tempGrid;
                    }
                    else if (filterEqual)
                    {
                        TipsManager.Instance.ShowTips(LocalTextType.Rune_Promote1);
                    }
                    else
                    {
                        TipsManager.Instance.ShowTips(LocalTextType.Rune_Eliminate1);
                    }
                }
            }
        };

        ItemChoosePanel.ItemChooseShowData showData = new ItemChoosePanel.ItemChooseShowData()
        {
            createNum        = baseIdList.Count,
            title            = "选择符石",
            nullTips         = "您未拥有该类符石",
            cloneTemp        = m_trans_UIRSInfoSelectGrid.gameObject,
            onChooseCallback = () =>
            {
                if (tempSelectGemRuneStoneId != m_uint_selectRSBaseId)
                {
                    m_uint_selectRSBaseId = tempSelectGemRuneStoneId;
                    UpdateProccess(Data);
                }
            },
            gridCreateCallback = (obj, index) =>
            {
                if (index >= baseIdList.Count)
                {
                    Engine.Utility.Log.Error("OnSelectPromoteRuneStone error,index out of range");
                }
                else
                {
                    table.ItemDataBase      tempItemDataBase      = imgr.GetLocalDataBase <table.ItemDataBase>(baseIdList[index]);
                    table.RunestoneDataBase tempRuneStoneDataBase = imgr.GetLocalDataBase <table.RunestoneDataBase>(baseIdList[index]);
                    if (null == tempItemDataBase || null == tempRuneStoneDataBase)
                    {
                        Engine.Utility.Log.Error("OnSelectPromoteRuneStone error,get itemdatabase or tempItemDataBase null baseid:{0}", baseIdList[index]);
                    }
                    else
                    {
                        UIRSInfoSelectGrid gemRuneStoneGrid = obj.GetComponent <UIRSInfoSelectGrid>();
                        if (null == gemRuneStoneGrid)
                        {
                            gemRuneStoneGrid = obj.AddComponent <UIRSInfoSelectGrid>();
                        }
                        gemRuneStoneGrid.RegisterUIEventDelegate(eventDlg);
                        RuneStone rs = DataManager.Manager <ItemManager>()
                                       .GetTempBaseItemByBaseID <RuneStone>(baseIdList[index], ItemDefine.ItemDataType.RuneStone);
                        bool select = (baseIdList[index] == m_uint_selectRSBaseId);
                        bool enable = (!filterEqual) ? (rs.Grade >= selectAttrGrade) : (rs.Grade > selectAttrGrade);
                        gemRuneStoneGrid.SetGridViewData(baseIdList[index], select, enable);
                        if (select)
                        {
                            selectGemRuneStoneGrid   = gemRuneStoneGrid;
                            tempSelectGemRuneStoneId = baseIdList[index];
                        }
                    }
                }
            },
            desPassCallback = desLabAction,
        };
        DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.ItemChoosePanel, data: showData);
    }