Commit 4004cfd6 authored by lijin's avatar lijin

点击特效

parent e13926b5
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EffectItem : MonoBehaviour
{
public float life = 0;
public RectTransform Rect;
public void Init(Color c, Vector3 v)
{
MainData md = GameMgr.Ins.md;
Transform p = Rect.parent;
Rect.SetParent(md.imgpng.transform);
Rect.localPosition = v - new Vector3(md.png.width / 2, md.png.height / 2);
Rect.SetParent(p);
gameObject.SetActive(true);
}
// Update is called once per frame
void Update()
{
if (life > 0)
{
life -= Time.deltaTime;
if (life <= 0)
{
life = 0;
gameObject.SetActive(false);
GameMgr.Ins.eiMgr.Circle(this);
}
}
}
}
fileFormatVersion: 2
guid: e2c276431f99e6a42bbf529143c74d65
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: EffectItem
m_Shader: {fileID: 51, guid: 0000000000000000f000000000000000, type: 0}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords:
- _ALPHATEST_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AlphaTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: f4bb85eb67ae1b047adf11cdb81c8f3c, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- PixelSnap: 0
- _BumpScale: 1
- _ColorMask: 15
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EnableExternalAlpha: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Inside: 0
- _Metallic: 0
- _Mode: 1
- _OcclusionStrength: 1
- _Parallax: 0.02
- _R: 1
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _UVSec: 0
- _UseUIAlphaClip: 0
- _ZWrite: 1
- _sR: 0.5
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
fileFormatVersion: 2
guid: 159ffb2a2f9e3134a83b58d3b2073cfb
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class EffectItemMgr : MonoBehaviour
{
public List<EffectItem> useList = new List<EffectItem>();
public List<EffectItem> poolList = new List<EffectItem>();
public EffectItem item;
public EffectItem Get()
{
if (poolList.Count == 0)
{
EffectItem temp = Instantiate<EffectItem>(item, item.transform.parent);
poolList.Add(temp);
}
EffectItem ret = poolList[0];
poolList.RemoveAt(0);
useList.Add(ret);
return ret;
}
public void Circle(EffectItem temp)
{
if (useList.Contains(temp))
{
useList.Remove(temp);
poolList.Add(temp);
temp.gameObject.SetActive(false);
}
}
public void Create(Color c, Vector3 v)
{
Get().Init(c,v);
}
}
fileFormatVersion: 2
guid: e068ed22c2598024a8ae3e4666f7f5fc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -15,6 +15,7 @@ public class GameMgr : MonoBehaviour
public MainData md;
public MaskItemMgr miMgr;
public TextItemMgr tiMgr;
public EffectItemMgr eiMgr;
public Texture2D gray;
public void Init(string key, Texture2D png, Sprite jpg, ResJsonData json)
......
......@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
......@@ -80,13 +81,14 @@ public class MainData : MonoBehaviour
{
for (int i = 0; i < json.roomGroupsData.Count; i++)
{
if (json.roomGroupsData[i].roomIds.Contains(id))
RoomGroupsData rgd = json.roomGroupsData[i];
if (rgd.roomIds.Contains(id))
{
if (json.roomGroupsData[i].id == curGroupId || b)
if (rgd.id == curGroupId || b)
{
ExRoomDatas erd = new ExRoomDatas();
json.roomGroupsData[i].roomIds.Remove(id);
json.roomGroupsData[i].roomIdsOver.Add(id);
rgd.roomIds.Remove(id);
rgd.roomIdsOver.Add(id);
json.step.Add(id);
Color[] c_png = png.GetPixels();
for (int j = 0; j < json.allPos.Count; j++)
......@@ -99,6 +101,7 @@ public class MainData : MonoBehaviour
}
png.SetPixels(c_png);
png.Apply();
GameMgr.Ins.eiMgr.Create(new Color(rgd.R / 255f, rgd.G / 255f, rgd.B / 255f, 1), v);
GameMgr.Ins.tiMgr.CircleId(id);
GameMgr.Ins.miMgr.Play(v, id);
EventDispatcher.Dispatch(EventName.Event.Event_GropuItemChange, json.roomGroupsData[i]);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment