fix:1、更换项目,使用winter来创建
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using IgnoreOPS;
|
||||
using Spine.Unity;
|
||||
using LoveLegend;
|
||||
using UnityEngine;
|
||||
using FlowerPower;
|
||||
|
||||
public class CreatAnimalCard : MonoBehaviour
|
||||
{
|
||||
@@ -28,16 +30,13 @@ public class CreatAnimalCard : MonoBehaviour
|
||||
}
|
||||
orthoCamera = GameObject.Find("GameCamera").GetComponent<Camera>();
|
||||
|
||||
float size = 49.9f;
|
||||
float size = (float)Math.Round(28.125f / ((float)Screen.width / Screen.height), 4);
|
||||
string type = SystemInfo.deviceModel.ToLower().Trim();
|
||||
// Debug.Log($"type========={type}=={type.Substring(0, 3)}");
|
||||
if (type.Substring(0, 3) == "iph")
|
||||
// Debug.Log($"type==========={type}");
|
||||
if (type.Substring(0, 3) == "ipa")
|
||||
{//iPad机型
|
||||
size = (float)Math.Round(28.125f / ((float)Screen.width / Screen.height), 4);
|
||||
size = 49.9f;
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
size = (float)Math.Round(28.125f / ((float)Screen.width / Screen.height), 4);
|
||||
#endif
|
||||
|
||||
orthoCamera.orthographicSize = size;
|
||||
|
||||
@@ -58,31 +57,54 @@ public class CreatAnimalCard : MonoBehaviour
|
||||
{
|
||||
|
||||
//all_card_numbers *= 3;
|
||||
int money_rate = ConfigSystem.GetConfig<CommonModel>().rewardrate;
|
||||
int money_rate = ConfigSystem.GetCommonConf().rewardrate;
|
||||
List<int> type_list = new List<int>();
|
||||
List<int> this_timetype_list = new List<int>();
|
||||
// Debug.Log(card_layer);
|
||||
card_item_list.Clear();
|
||||
// if (card_layer < extra_max)
|
||||
// {
|
||||
// card_layer = extra_max;
|
||||
// }
|
||||
|
||||
// ---------- 新增:先从0~15中挑选 card_type_max 个不同的类型 ----------
|
||||
List<int> allTypes = Enumerable.Range(0, 15).ToList(); // [0,1,2,...,15]
|
||||
List<int> chosenTypes = new List<int>();
|
||||
for (int i = 0; i < card_type_max; i++)
|
||||
{
|
||||
int idx = UnityEngine.Random.Range(0, allTypes.Count);
|
||||
chosenTypes.Add(allTypes[idx]);
|
||||
allTypes.RemoveAt(idx); // 确保不重复
|
||||
}
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
// 打印选出来的类型池
|
||||
Debug.Log($"[CreatCardNew] 随机选出的 {card_type_max} 个类型: {string.Join(",", chosenTypes)}");
|
||||
|
||||
for (int i = 0; i < all_card_numbers; i++)
|
||||
{
|
||||
int type = 0;
|
||||
if (GameHelper.IsGiftSwitch() && UnityEngine.Random.Range(0, 100) < money_rate) type = 15;
|
||||
else type = UnityEngine.Random.Range(0, card_type_max);
|
||||
if (!GameHelper.IsGiftSwitch() && type == 15){
|
||||
type = UnityEngine.Random.Range(0, card_type_max-1);
|
||||
var randomNum = UnityEngine.Random.Range(0, 100);
|
||||
// Debug.Log($"[creat] money_rate------------ {randomNum}==={money_rate}");
|
||||
if (GameHelper.IsGiftSwitch() && randomNum < money_rate)
|
||||
{
|
||||
type = 15; // 金币
|
||||
}
|
||||
else
|
||||
{
|
||||
// 在挑选好的类型池里再随机
|
||||
type = chosenTypes[UnityEngine.Random.Range(0, chosenTypes.Count)];
|
||||
}
|
||||
|
||||
// if (GameHelper.IsGiftSwitch() && type == 15)
|
||||
// {
|
||||
// type = UnityEngine.Random.Range(0, card_type_max - 1);
|
||||
// }
|
||||
#if UNITY_EDITOR
|
||||
// type = 1;
|
||||
#endif
|
||||
type_list.Add(type);
|
||||
type_list.Add(type);
|
||||
type_list.Add(type);
|
||||
if (!this_timetype_list.Contains(type)) this_timetype_list.Add(type);
|
||||
}
|
||||
SaveData.GetSaveobject().this_time_cardtype = this_timetype_list.Count;
|
||||
SaveData.GetSaveObject().this_time_cardtype = this_timetype_list.Count;
|
||||
|
||||
for (int i = 0; i < card_layer; i++)
|
||||
{
|
||||
@@ -188,8 +210,7 @@ public class CreatAnimalCard : MonoBehaviour
|
||||
}
|
||||
private GameObject Popup;
|
||||
|
||||
private GameObject Normal;
|
||||
#if UNITY_EDITOR || UNITY_IOS
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
@@ -199,16 +220,13 @@ public class CreatAnimalCard : MonoBehaviour
|
||||
if (Popup == null) Popup = GameObject.Find("Popup");
|
||||
if (Popup.transform.childCount != 0) return;
|
||||
|
||||
if (Normal == null) Normal = GameObject.Find("Normal");
|
||||
if (Normal.transform.childCount != 0) return;
|
||||
|
||||
Ray ray = orthoCamera.ScreenPointToRay(Input.mousePosition);
|
||||
RaycastHit hit;
|
||||
int layerMask = 1 << 6; // 只与第8层的碰撞器碰撞
|
||||
// 如果射线与layerMask指定层的碰撞器发生碰撞
|
||||
if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask))
|
||||
{
|
||||
Debug.Log("Hit " + hit.collider.gameObject.name);
|
||||
// Debug.Log("Hit " + hit.collider.gameObject.name);
|
||||
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.card_click, hit.collider.gameObject.name);
|
||||
// 在此处添加点击物体后的逻辑
|
||||
@@ -219,54 +237,33 @@ public class CreatAnimalCard : MonoBehaviour
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private GameObject disappear01;
|
||||
private GameObject disappear02;
|
||||
private static Dictionary<int, GameObject> aniDict = new Dictionary<int, GameObject>();
|
||||
|
||||
public void creatSpine(int type, Vector3 vec3)
|
||||
{
|
||||
// if (disappear01 == null) disappear01 = Resources.Load<GameObject>("card/bg_img/fx_disaappear_01");
|
||||
// if (disappear02 == null) disappear02 = Resources.Load<GameObject>("card/bg_img/fx_disaappear_01");
|
||||
|
||||
// if (type == 0)
|
||||
// {
|
||||
// SkeletonAnimation temp = Instantiate(disappear01, new Vector3(vec3.x, vec3.y, 110), Quaternion.identity, gameObject.transform).GetComponent<SkeletonAnimation>();
|
||||
// temp.AnimationState.SetAnimation(0, "disappear01", true);
|
||||
// temp.AnimationState.Complete += (trackEntry) =>
|
||||
// {
|
||||
// Destroy(temp.gameObject);
|
||||
// };
|
||||
// }
|
||||
// if (type == 2)
|
||||
// {
|
||||
// SkeletonAnimation temp = Instantiate(disappear02, new Vector3(vec3.x, vec3.y, 110), Quaternion.identity, gameObject.transform).GetComponent<SkeletonAnimation>();
|
||||
// temp.AnimationState.SetAnimation(0, "fx_disaappear_01", true);
|
||||
// temp.AnimationState.Complete += (trackEntry) =>
|
||||
// {
|
||||
// Destroy(temp.gameObject);
|
||||
// };
|
||||
// }
|
||||
|
||||
GameObject ani = GetObject(type);
|
||||
SkeletonAnimation temp = Instantiate(ani, new Vector3(vec3.x, vec3.y, 100.5f), Quaternion.identity, gameObject.transform).GetComponent<SkeletonAnimation>();
|
||||
temp.AnimationState.SetAnimation(0, "disappear02", true);
|
||||
// temp.timeScale = 2.5f;
|
||||
temp.AnimationState.Complete += (trackEntry) =>
|
||||
if (disappear01 == null) disappear01 = Resources.Load<GameObject>("card/bg_img/fx_disaappear_1");
|
||||
if (disappear02 == null) disappear02 = Resources.Load<GameObject>("card/bg_img/fx_disaappear_2");
|
||||
if (type == 1)
|
||||
{
|
||||
Destroy(temp.gameObject);
|
||||
};
|
||||
}
|
||||
SkeletonAnimation temp = Instantiate(disappear01, new Vector3(vec3.x, vec3.y, 110), Quaternion.identity, gameObject.transform).GetComponent<SkeletonAnimation>();
|
||||
temp.AnimationState.SetAnimation(0, "disappear01", true);
|
||||
temp.AnimationState.Complete += (trackEntry) =>
|
||||
{
|
||||
Destroy(temp.gameObject);
|
||||
};
|
||||
}
|
||||
if (type == 2)
|
||||
{
|
||||
SkeletonAnimation temp = Instantiate(disappear02, new Vector3(vec3.x, vec3.y, 110), Quaternion.identity, gameObject.transform).GetComponent<SkeletonAnimation>();
|
||||
temp.AnimationState.SetAnimation(0, "disappear02", true);
|
||||
temp.AnimationState.Complete += (trackEntry) =>
|
||||
{
|
||||
Destroy(temp.gameObject);
|
||||
};
|
||||
}
|
||||
// temp.GetComponent<SpriteRenderer>().sprite = img_list[card_item_list[i][j].card_type];
|
||||
|
||||
GameObject GetObject(int type) {
|
||||
if (!aniDict.ContainsKey(type)) {
|
||||
if (type == 15) {
|
||||
aniDict[type] = Resources.Load<GameObject>("card/bg_img/fx_disaappear_2");
|
||||
} else {
|
||||
aniDict[type] = Resources.Load<GameObject>("card/bg_img/fx_disaappear_0" + (type + 1));
|
||||
}
|
||||
}
|
||||
return aniDict[type];
|
||||
}
|
||||
|
||||
int getMaplayer(List<List<Vector2>> map_list)
|
||||
|
||||
Reference in New Issue
Block a user