Exemplo n.º 1
0
    private void Show(int sirenID, SirenConfigData configData)
    {
        this.DisplaySiren();
        iCurSirenID     = sirenID;
        dCurSirenConfig = configData;
        if (SirenDict.ContainsKey(sirenID))
        {
            SirenDict[sirenID].SetActive(true);
        }
        else
        {
            GameObject siren = (GameObject)Instantiate(configData._prefab);
            //siren.transform.parent = ViewPoint;
            siren.transform.position = configData._sirenPosition;
            //siren.transform.localScale = vSirenScale;
            SirenDict.Add(sirenID, siren);

            //点击事件
            var cb = siren.AddComponent <LocalButtonCallBack>();
            cb.SetCallBackFuntion(ClickSiren);
            var bc = siren.AddComponent <BoxCollider>();
            bc.center = new Vector3(0, 10, 0);
            bc.size   = new Vector3(10, 20, 10);

            //挡板
            if (m_markGameObj != null)
            {
                m_markGameObj = new GameObject();
                m_markGameObj.transform.position = configData._sirenPosition - Vector3.forward * 10;
                BoxCollider markBC = m_markGameObj.AddComponent <BoxCollider>();
                markBC.size = new Vector3(2000, 2000, 10);
            }
        }
        PlayAnimation(configData._defaultAnim);
        //如果未解锁,隐藏
        if (configData._growthLevels <= 0)
        {
            SirenDict[sirenID].SetActive(false);
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// 更新妖女模型
    /// </summary>
    /// <param name="sirenID"></param>
    public void UpdateSiren(int sirenID, SirenConfigData configData)
    {
        Destroy(SirenDict[sirenID]);
        dCurSirenConfig = configData;
        GameObject siren = (GameObject)Instantiate(configData._prefab);

        //siren.transform.parent = ViewPoint;
        siren.transform.position = configData._sirenPosition;
        //siren.transform.localScale = vSirenScale;
        SirenDict[sirenID] = siren;

        //增加点击事件
//		var cb = siren.AddComponent<LocalButtonCallBack>();
//		cb.SetCallBackFuntion(ClickSiren);
//		var bc = siren.AddComponent<BoxCollider>();
//		bc.center = new Vector3(0,10,0);
//		bc.size = new Vector3(10,20,10);


        CameraPos = configData._cameraPosition;
        FollowCamera.SetInitDistanceFromPlayer(SirenDict[sirenID].transform, CameraPos, true);
    }
Exemplo n.º 3
0
 /// <summary>
 /// 显示妖女
 /// </summary>
 /// <param name="sirenID"></param>
 /// <param name="configData"></param>
 /// <param name="newCameraPos"></param>
 public void ShowSiren(int sirenID, SirenConfigData configData)
 {
     this.Show(sirenID, configData);
     CameraPos = configData._cameraPosition;
     FollowCamera.SetInitDistanceFromPlayer(SirenDict[sirenID].transform, CameraPos, true);
 }
Exemplo n.º 4
0
    private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets,
                                               string[] movedAssets, string[] movedFromPath)
    {
        if (CheckResModified(importedAssets) || CheckResModified(deletedAssets) || CheckResModified(movedAssets))
        {
            string     path = System.IO.Path.Combine(RESOURCE_TRAP_CONFIG_FOLDER, "PlayerSirenConfig.xml");
            TextReader tr   = new StreamReader(path);
            string     text = tr.ReadToEnd();

            if (text == null)
            {
                Debug.LogError("Player level config file not exist");
                return;
            }
            else
            {
                XmlSpreadSheetReader.ReadSheet(text);
                XmlSpreadSheet sheet = XmlSpreadSheetReader.Output;
                string[]       keys  = XmlSpreadSheetReader.Keys;

                object[] levelIds = sheet[keys[0]];

                List <PlayerSirenConfigData> tempList        = new List <PlayerSirenConfigData>();
                List <PlayerSirenConfigData> tempWithoutList = new List <PlayerSirenConfigData>();

                /* 普通方法
                 * for (int i = 0; i < levelIds.Length; i++)
                 * {
                 *  if (0 == i || 1 == i) continue;
                 *  PlayerSirenConfigData data = new PlayerSirenConfigData();
                 *
                 *  data._sirenID = Convert.ToInt32(sheet["SirenID"][i]);
                 *  data._name = Convert.ToString(sheet["Name"][i]);
                 *  //data._damageID = Convert.ToInt32(sheet["BoxID"][i]);
                 *  //data._damageName = Convert.ToString(sheet["BoxName"][i]);
                 *
                 *  //data._damagePrefab = (GameObject)AssetDatabase.LoadAssetAtPath(prefabPath, typeof(GameObject));
                 *  //string correspondingItemIDStr = Convert.ToString(sheet["BoxGoodsDrop"][i]);
                 *  //string[] splitCorrespondingItemIDStrs = correspondingItemIDStr.Split("+".ToCharArray());
                 *  //data._correspondingItemID = Convert.ToInt32(splitCorrespondingItemIDStrs[0]);
                 *
                 *  tempList.Add(data);
                 * }
                 */
                for (int i = 0; i < levelIds.Length; i++)
                {
                    if (0 == i || 1 == i)
                    {
                        continue;
                    }

                    for (int clone = 0; clone < 2; clone++)
                    {
                        List <PlayerSirenConfigData> temporaryList;
                        if (clone == 0)
                        {
                            temporaryList = tempList;
                        }
                        else
                        {
                            temporaryList = tempWithoutList;
                        }

                        //导表
                        int sirenID = Convert.ToInt32(sheet["SirenID"][i]);
                        var temp    = temporaryList.SingleOrDefault(p => p._sirenID == sirenID);
                        if (temp == null)
                        {
                            temp = new PlayerSirenConfigData();

                            temp._sirenID    = sirenID;
                            temp._name       = Convert.ToString(sheet["Name"][i]);
                            temp._nameRes    = Convert.ToString(sheet["NameRes"][i]);
                            temp._portraitID = Convert.ToString(sheet["PortraitID"][i]);
                            //temp._portraitPrefab = (GameObject)Resources.LoadAssetAtPath("Assets/Prefab/GUI/SirenHead/" + temp._portraitID + ".prefab", typeof(GameObject));

                            //temp._rejectAnim = Convert.ToString(sheet["RejectAnim"][i]);
                            //temp._shyAnim = Convert.ToString(sheet["ShyAnim"][i]);
                            //temp._temptationAnim = Convert.ToString(sheet["TemptationAnim"][i]);

                            string[] composeCost = Convert.ToString(sheet["ComposeCost"][i]).Split('+');
                            temp._composeCost_itemID  = Convert.ToInt32(composeCost[0]);
                            temp._composeCost_itemNum = Convert.ToInt32(composeCost[1]);

                            temp._unlockTips = Convert.ToString(sheet["UnlockTips"][i]);

                            temp._growthMaxLevel = Convert.ToInt32(sheet["GrowthMaxLevel"][i]);

                            temp._defaultWordCd = Convert.ToInt32(sheet["DefaultWordCd"][i]);

                            temp._refiningColdTime = Convert.ToInt32(sheet["RefiningColdTime"][i]);

                            string[] unlockStr = Convert.ToString(sheet["Unlock"][i]).Split('|');
                            temp.Unlock = new UnlockCondition[unlockStr.Length];
                            for (int p = 0; p < unlockStr.Length; p++)
                            {
                                temp.Unlock[p] = new UnlockCondition();
                                string[] unlock = unlockStr[p].Split('+');
                                temp.Unlock[p].Type       = Convert.ToInt32(unlock[0]);
                                temp.Unlock[p].Condition1 = Convert.ToInt32(unlock[1]);
                                temp.Unlock[p].Condition2 = Convert.ToInt32(unlock[2]);
                            }

                            temp._SirenText   = Convert.ToString(sheet["SirenText"][i]);
                            temp._UnlockText  = Convert.ToString(sheet["UnlockText"][i]);
                            temp._SirenPrice  = Convert.ToInt32(sheet["SirenPrice"][i]);
                            temp._BattleVoice = Convert.ToString(sheet["BattleVoice"][i]);


                            temporaryList.Add(temp);
                        }

                        if (temp._sirenConfigDataList == null)
                        {
                            temp._sirenConfigDataList = new List <SirenConfigData>();
                        }

                        SirenConfigData data = new SirenConfigData();
                        data._dwDisplayID = Convert.ToString(sheet["dwDisplayID"][i]);
                        data._dzDisplayID = Convert.ToString(sheet["dzDisplayID"][i]);
                        if (clone == 0)
                        {
                            data._prefab   = (GameObject)Resources.LoadAssetAtPath("Assets/Prefab/NPC/Prefab/" + data._dwDisplayID + ".prefab", typeof(GameObject));
                            data._dzPrefab = (GameObject)Resources.LoadAssetAtPath("Assets/Prefab/NPC/Prefab/" + data._dzDisplayID + ".prefab", typeof(GameObject));


                            string titlePrefabStr = Convert.ToString(sheet["TitlePrefab"][i]);
                            data._TitlePrefab = (GameObject)Resources.LoadAssetAtPath("Assets/Prefab/GUI/IconPrefab/SirenIcon/" + titlePrefabStr + ".prefab", typeof(GameObject));
                            string namePrefabStr = Convert.ToString(sheet["NamePrefab"][i]);
                            data._NamePrefab = (GameObject)Resources.LoadAssetAtPath("Assets/Prefab/GUI/IconPrefab/SirenIcon/" + namePrefabStr + ".prefab", typeof(GameObject));
                        }
                        data._defaultAnim   = Convert.ToString(sheet["DefaultAnim"][i]);
                        data._fearAnim      = Convert.ToString(sheet["FearAnim"][i]);
                        data._growthCost    = Convert.ToInt32(sheet["GrowthCost"][i]);
                        data._growthEffect  = Convert.ToString(sheet["GrowthEffect"][i]);
                        data._growthLevels  = Convert.ToInt32(sheet["GrowthLevels"][i]);
                        data._touchAnim     = Convert.ToString(sheet["TouchAnim"][i]);
                        data._touchWord     = ParseString(Convert.ToString(sheet["TouchWord"][i]));
                        data._defaultWord   = ParseString(Convert.ToString(sheet["DefaultWord"][i]));
                        data._successWord   = ParseString(Convert.ToString(sheet["SuccessWord"][i]));
                        data._failWord      = ParseString(Convert.ToString(sheet["FailWord"][i]));
                        data._sitEffect     = Convert.ToInt32(sheet["SitEffect"][i]);
                        data._sirenPower    = Convert.ToInt32(sheet["SirenPower"][i]);
                        data._sitEffectTips = Convert.ToString(sheet["SitEffectTips"][i]);

                        data._BattleVoice = Convert.ToString(sheet["BattleVoice"][i]);

                        string   posStr  = Convert.ToString(sheet["CameraPosition"][i]);
                        string[] vector3 = posStr.Split('+');//A+1+2+3
                        data._cameraPosition = new Vector3(Convert.ToSingle(vector3[1]), Convert.ToSingle(vector3[2]), Convert.ToSingle(vector3[3]));

                        data._touchSound = Convert.ToString(sheet["TouchSound"][i]);

                        data._refiningShakeTime        = Convert.ToInt32(sheet["RefiningShakeTime"][i]);
                        data._refiningShakeAttenuation = Convert.ToSingle(sheet["RefiningShakeAttenuation"][i]);
                        data._refiningShakeElasticity  = Convert.ToSingle(sheet["RefiningShakeElasticity"][i]);
                        data._refiningShakeInitSpeed   = Convert.ToSingle(sheet["RefiningShakeInitSpeed"][i]);

                        string   sirenPosStr  = Convert.ToString(sheet["SirenPosition"][i]);
                        string[] sirenVector3 = sirenPosStr.Split('+');//A+1+2+3
                        data._sirenPosition = new Vector3(Convert.ToSingle(sirenVector3[1]), Convert.ToSingle(sirenVector3[2]), Convert.ToSingle(sirenVector3[3]));

                        string[] refiningItemStr = Convert.ToString(sheet["RefiningItem"][i]).Split('+');
                        data._refiningItem_itemID  = Convert.ToInt32(refiningItemStr[0]);
                        data._refiningItem_itemNum = Convert.ToInt32(refiningItemStr[1]);
                        data._growthLvlLimit       = Convert.ToInt32(sheet["GrowthLvlLimit"][i]);

                        data._GrowthEffect    = Convert.ToString(sheet["GrowthEffect"][i]);
                        data._MaxGrowthEffect = Convert.ToString(sheet["MaxGrowthEffect"][i]);

                        data._LevelUpText = Convert.ToString(sheet["LevelUpText"][i]);
                        string[] sirenSkillIDStr    = Convert.ToString(sheet["SirenSkillID"][i]).Split('|');
                        int      sirenSkillIDLength = sirenSkillIDStr.Length;
                        data._SirenSkillIDs = new SirenSkillID[sirenSkillIDLength];
                        for (int p = 0; p < sirenSkillIDLength; p++)
                        {
                            string[] strs = sirenSkillIDStr[p].Split('+');
                            data._SirenSkillIDs[p]          = new SirenSkillID();
                            data._SirenSkillIDs[p].Vocation = Convert.ToInt32(strs[0]);
                            data._SirenSkillIDs[p].SkillID  = Convert.ToInt32(strs[1]);
                        }
                        //data._LevelUpExp = Convert.ToInt32(sheet["LevelUpExp"][i]);
                        data._SirenSkillIDText = Convert.ToString(sheet["SirenSkillIDText"][i]);

                        data.SirenBreakStage    = Convert.ToInt32(sheet["SirenBreakStage"][i]);
                        data.BreakStageMaxLevel = Convert.ToInt32(sheet["BreakStageMaxLevel"][i]);
                        string[] breakConditionStr = Convert.ToString(sheet["BreakCondition"][i]).Split('|');                        //id+num|id+num
                        data.BreakCondition = new SirenBreakCondition[breakConditionStr.Length];
                        for (int p = 0; p < breakConditionStr.Length; p++)
                        {
                            string[] value = breakConditionStr[p].Split('+');
                            data.BreakCondition[p] = new SirenBreakCondition();
                            if (value.Length >= 2)
                            {
                                data.BreakCondition[p].ItemID  = Convert.ToInt32(value[0]);
                                data.BreakCondition[p].ItemNum = Convert.ToInt32(value[1]);
                            }
                        }
                        data.BreakDesc         = Convert.ToString(sheet["BreakDesc"][i]);
                        data.SirenTeamBuffID   = Convert.ToInt32(sheet["SirenTeamBuffID"][i]);
                        data.SirenTeamBuffText = Convert.ToString(sheet["SirenTeamBuffText"][i]);

                        temp._sirenConfigDataList.Add(data);
                    }
                }


                CreateSceneConfigDataBase(tempList);
                CreateWithOutResDataBase(tempWithoutList);
            }
        }
    }
Exemplo n.º 5
0
        public void Show(ButtonCallBack callBack, SirenConfigData data, int nextMaxLevel, List <SirenGrowthEffect> curGrowthEffList, List <SirenGrowthEffect> nextGrowthEffList)
        {
            Button_Break.SetCallBackFuntion(callBack);

            //材料
            Materials.ApplyAllItem(p => p.SetActive(false));

            var breakCondition = data.BreakCondition;

            switch (breakCondition.Length)
            {
            case 1:
                Materials[0].transform.localPosition = m_OneMaterialPos;
                m_isMaterialsSatisfy[0] = false;
                m_isMaterialsSatisfy[1] = true;
                break;

            case 2:
                Materials[0].transform.localPosition = m_TwoMaterialPos[0];
                Materials[1].transform.localPosition = m_TwoMaterialPos[1];
                m_isMaterialsSatisfy[0] = false;
                m_isMaterialsSatisfy[1] = false;
                break;

            default:
                m_isMaterialsSatisfy[0] = true;
                m_isMaterialsSatisfy[1] = true;
                break;
            }
            for (int i = 0; i < breakCondition.Length; i++)
            {
                Materials[i].SetActive(true);
                var itemData = ItemDataManager.Instance.GetItemData(breakCondition[i].ItemID);
                if (itemData != null)
                {
                    UI_Materials[i].spriteName = itemData.smallDisplay;
                    Swith_MaterialColors[i].ChangeSprite(itemData._ColorLevel + 1);
                }
                else
                {
                    Materials[i].SetActive(false);
                }
                Label_MaterialProcesses[i].text = GetMaterialProcess(breakCondition[i].ItemID, breakCondition[i].ItemNum, out m_isMaterialsSatisfy[i]);
            }

            if (m_isMaterialsSatisfy[0] && m_isMaterialsSatisfy[1])
            {
                StartCoroutine(ChangeButtonEnable(Button_Break, true));
            }
            else
            {
                StartCoroutine(ChangeButtonEnable(Button_Break, false));
            }

            //等级上限
            Label_LevelCeiling.text = LanguageTextManager.GetString("IDS_I2_14") + NGUIColor.SetTxtColor(data.BreakStageMaxLevel.ToString(), TextColor.white)
                                      + " → " + NGUIColor.SetTxtColor(nextMaxLevel, TextColor.green);
            //团队技能
            Label_Skill.text = NGUIColor.SetTxtColor(LanguageTextManager.GetString("IDS_I2_15"), TextColor.DescriptionYellow) +
                               NGUIColor.SetTxtColor(LanguageTextManager.GetString(data.BreakDesc), TextColor.white);

            //属性增长
            int listLenget = curGrowthEffList.Count;

            for (int i = 0; i < m_attributeItemList.Count; i++)
            {
                if (i >= listLenget)
                {
                    m_attributeItemList[i].gameObject.SetActive(false);
                }
                else
                {
                    m_attributeItemList[i].gameObject.SetActive(true);
                    m_attributeItemList[i].InitBreakLabel(curGrowthEffList[i].EffectData.IDS, curGrowthEffList[i].EffectData.EffectRes,
                                                          curGrowthEffList[i].GrowthEffectValue, nextGrowthEffList[i].GrowthEffectValue);
                }
            }

            transform.localPosition = Vector3.zero;
        }