Exemple #1
0
//	void Awake () {
//		Init ();
//	}

    public void init(FightEntity entity)
    {
        this.fightEntity     = entity;
        this.clientRunTime   = (ClientRunTime)entity.map;
        this.localPositionV2 = new Vector2();
        this.localScaleV3    = new Vector3(1, 1, 1);
        this.materialList    = new List <Material> ();
        Material material;

        //一次性取出所有 MeshRenderer ParticleSystem
        Renderer[] renderers = this.GetComponentsInChildren <Renderer>();
        foreach (Renderer renderer in renderers)
        {
            material          = renderer.material;
            renderer.material = material;
            materialList.Add(material);
        }
        imageArr = this.GetComponentsInChildren <Image>();

        if (this.fightEntity.type == ConfigConstant.ENTITY_PLAYER)
        {
            Image image = Tools.FindChild2("Canvas/faceImage", this.gameObject).transform.GetChild(0).GetComponent <Image> ();
            ClientPlayerEntity player = (ClientPlayerEntity)entity;
            ResFactory.setHeadSprite(player.headUrl, image, player.uid);
            //Sprite spr = ((Player)player.view).faceSprite;
            //image.sprite = spr;
        }

        lastAlpha = 1f;
        ChangeAlpha(0);
    }
Exemple #2
0
    public void ResLoadTest()
    {
        // 注册自定义类型的 Res
        ResFactory.RegisterCustomRes((address) =>
        {
            if (address.StartsWith("test://"))
            {
                return(new TestRes()
                {
                    Name = address
                });
            }

            return(null);
        });

        // 测试
        var resLoader = new ResLoader();

        var iconTextureRes = resLoader.LoadRes("test://icon_texture");

        Assert.IsTrue(iconTextureRes is TestRes);
        Assert.AreEqual(1, iconTextureRes.RefCount);
        Assert.AreEqual(ResState.Loaded, iconTextureRes.State);

        resLoader.UnloadAllAsset();

        Assert.AreEqual(0, iconTextureRes.RefCount);
        Assert.AreEqual(ResState.NotLoad, iconTextureRes.State);


        resLoader = null;
    }
        public void ResLoaderTest()
        {
            ResFactory.RegisterCustomRes((resSearchKeys) =>
            {
                if (resSearchKeys.Address.StartsWith("test://"))
                {
                    return(new TestRes()
                    {
                        Name = resSearchKeys.Address,
                        ResType = resSearchKeys.ResType
                    });
                }

                return(null);
            });
            // 测试
            var resLoader = new ResLoader();

            var iconTextureRes = resLoader.LoadRes(new ResSearchKeys("test://icon_texture", typeof(Texture2D)));

            Assert.IsTrue(iconTextureRes is TestRes);
            Assert.AreEqual(1, iconTextureRes.RefCount);
            Assert.AreEqual(ResState.Loaded, iconTextureRes.State);

            resLoader.UnloadAllAssets();

            Assert.AreEqual(0, iconTextureRes.RefCount);
            Assert.AreEqual(ResState.NotLoad, iconTextureRes.State);
        }
Exemple #4
0
 public static void clearChildren(Transform parent)
 {
     foreach (Transform child in parent)
     {
         ResFactory.Destroy(child.gameObject);
     }
 }
Exemple #5
0
 /// <summary>
 /// 在隐藏的时候 添加到Pool里面。
 /// </summary>
 void OnDisable()
 {
     if (!this.gameObject.activeSelf && !this.isDestroyed)
     {
         ResFactory.addPool(this.gameObject);
     }
 }
Exemple #6
0
    public GameObject addEffect(string effect, bool sync = true)
    {
        GameObject go = ResFactory.getCacheEffect(effect, this.clientRunTime);

        go.transform.SetParent(Tools.FindChild2(sync ? "personEarth/personDirection/buff" : "personEarth/effect", this.gameObject).transform, false);
        return(go);
    }
Exemple #7
0
 void OnDestroy()
 {
     this.isDestroyed = true;
     if (!this.clientRunTime.cleared)
     {
         ResFactory.removePool(this.gameObject);
     }
 }
Exemple #8
0
    public override void init()
    {
        base.init();
        GameObject go = ResFactory.getCacheEffect(this._fightEntity.data["resId"].ToString(), this.clientRunTime);

        //GameObject go = ResFactory.instance.bean2;
        go.transform.SetParent(skewBody.transform, false);
        //this.name = ( (CallEntity)this._fightEntity ).index.ToString();
    }
Exemple #9
0
    public void init()
    {
        ///这个要替换其他的btn。
        bool visible = Utils.equal(DataManager.inst.systemSimple, "testBtn", 1);

        this.voiceBtn.gameObject.SetActive(visible);

        ClientRunTime clientRunTime = FightMain.instance.selection;

        clientRunTime.registerClientView(this);
        this.rank.init(Tools.FindChild2("topRightLayer/scoreRankLayer", this.gameObject));
        //TODO:断网重连 这个不知道会不会有问题。 可能有坑。 先留着。
        this.initCards();

        GameObject scoreGame = Tools.FindChild2("topRightLayer/teamBallsLayer", this.gameObject);

        if (clientRunTime.mapData.isTeam)
        {
            this.scoreView = scoreGame.GetComponent <RadishScoreView>();
            if (null == this.scoreView)
            {
                this.scoreView = scoreGame.AddComponent <RadishScoreView>();
            }

            scoreView.init(clientRunTime);
            scoreGame.SetActive(true);
        }
        else
        {
            scoreGame.SetActive(false);
        }


        clientRunTime.addListener(EventConstant.END, (e) => {
            GameObject finish = ResFactory.createObject <GameObject>(ResFactory.getOther("finish"));
            finish.transform.SetParent(this.transform, false);
            TimerManager.inst.Add(2, 1, (t) => {
                Destroy(finish);
            });
        });

        this.videoChange();

        clientRunTime.addListener(EventConstant.LOGIC_COMPLETE, (e) => {
            if (null != clientRunTime.localPlayer.reviveAction)
            {
                this.playerReliveText.enabled = true;
                //TODO:改成语言配置
                string str = string.Format("复活中...{0:F1}", clientRunTime.localPlayer.reviveAction.time / 1000f);
                this.playerReliveText.text = str;
            }
            else
            {
                this.playerReliveText.enabled = false;
            }
        });
    }
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="resFactory"></param>
 /// <param name="objName"></param>
 /// <param name="initCount"></param>
 public GameObjectPool(ResFactory <GameObject> resFactory, string objName, int initCount = 0)
 {
     mFactory    = resFactory;
     mCacheStack = new Stack <GameObject>();
     for (int i = 0; i < initCount; i++)
     {
         mCacheStack.Push(InstantiateGO(mFactory.GetRes(objName)));
     }
 }
Exemple #11
0
 public void clearFight()
 {
     ResFactory.clear();
     Utils.clearObject(this.server);
     Utils.clearObject(this._selection);
     ResFactory.enable = true;
     this._selection   = null;
     this.server       = null;
 }
    public FightObject createFightObject(FightEntity entity)
    {
        GameObject  go          = null;
        FightObject fightObject = null;

        switch (entity.type)
        {
        case ConfigConstant.ENTITY_LOOP_BEAN:    //
            go          = ResFactory.instance.getBean(((LoopBeanEntity)entity).itemType);
            fightObject = go.GetComponent <Bean>();
            break;

        case ConfigConstant.ENTITY_PLAYER:
            if (((PlayerEntity)entity).uid == this.uid)
            {
                go          = ResFactory.createObject <GameObject>(ResFactory.instance.player);
                fightObject = go.AddComponent <PlayerSelf>();
            }
            else
            {
                go          = ResFactory.createObject <GameObject>(ResFactory.instance.player);
                fightObject = go.AddComponent <Enemy>();
            }
            break;

        case ConfigConstant.ENTITY_BULLET:
            fightObject = ResFactory.getBullet(entity.data["resId"].ToString(), this);
            break;

        case ConfigConstant.ENTITY_PRICE_BEAN:
            go          = ResFactory.instance.getBean(((PriceBeanEntity)entity).itemType);
            fightObject = go.GetComponent <Bean>();
            break;

        case ConfigConstant.ENTITY_CALL:
            go          = ResFactory.createObject <GameObject>(ResFactory.instance.call);
            fightObject = go.GetComponent <CallView>();
            break;

        case ConfigConstant.ENTITY_BARRIER:
            go          = ResFactory.loadPrefab(entity.data["resId"].ToString());
            go          = ResFactory.createObject <GameObject>(go);
            fightObject = go.GetComponent <Barrier>();
            break;

        case ConfigConstant.ENTITY_RADISH:
            go          = ResFactory.loadPrefab("radish");
            go          = ResFactory.createObject <GameObject>(go);
            fightObject = go.AddComponent <Radish>();
            break;
        }
        entity.viewData.view    = entity.view = fightObject;
        fightObject.fightEntity = entity;

        return(fightObject);
    }
Exemple #13
0
 public void init(GameObject parent, int index)
 {
     this.go        = ResFactory.loadPrefab("scoreRankItem");
     this.go        = ResFactory.createObject <GameObject>(this.go);
     this.bg        = this.go.transform.FindChild("bgImage").GetComponent <Image>();
     this.nameText  = this.go.transform.FindChild("nameText").GetComponent <Text>();
     this.scoreText = this.go.transform.FindChild("scoreText").GetComponent <Text>();
     this.indexText = this.go.transform.FindChild("indexText").GetComponent <Text>();
     this.go.transform.SetParent(parent.transform, false);
 }
Exemple #14
0
    public void playVoice(string voiceName, float delay = 0f)
    {
        AudioClip  audioClip = ResFactory.loadVoiceClip(voiceName);
        GameObject go        = ResFactory.loadPrefab("audio");

        go      = ResFactory.createObject <GameObject>(go);
        go.name = voiceName;
        AudioSource audioSource = go.GetComponent <AudioSource>();

        audioSource.clip = audioClip;
        audioSource.PlayDelayed(delay);
        ResFactory.Destroy(go, audioClip.length + delay);
        go.transform.SetParent(this.audioController.transform);
    }
Exemple #15
0
    private void updateView()
    {
        this.gameObject.SetActive(true);

        this.fillImg.sprite  = this.bgImg.sprite = ResFactory.getSprite(this.cardData.id);
        this.slider.value    = 1;
        this.gameObject.name = this._cardData.id;

        float scale1 = 0.1f;
        float scale2 = 0.67f;

        LeanTween.cancel(this.gameObject, false);
        this.gameObject.transform.localRotation = new Quaternion();
        this.gameObject.transform.localScale    = new Vector3(scale1, scale1, scale1);
        LeanTween.scale(this.gameObject, new Vector3(scale2, scale2, scale2), 0.3f).tweenType = LeanTweenType.easeOutBack;
        //DOTween.To (() => this.transform.localScale, x => this.transform.localScale = x, new Vector3(scale,scale,scale), 0.3f);
    }
Exemple #16
0
 protected override void preInit()
 {
     base.preInit();
     this.mainBody = this.gameObject.transform;
     if (this.isNullBullet)
     {
         AutoDestroy auto = this.gameObject.GetComponent <AutoDestroy>();
         if (null != auto)
         {
             ResFactory.Destroy(auto);
         }
     }
     else
     {
         this._particles = new List <ParticleSystem>(this.GetComponentsInChildren <ParticleSystem>()).ConvertAll <ParticleReset>((p) => { return(new ParticleReset(p)); });
     }
 }
Exemple #17
0
    void Awake()
    {
        GameObject go = ResFactory.loadPrefab("card");

        for (int i = 0, len = this._initCards.Length; i < len; i++)
        {
            Card card = ResFactory.createObject <GameObject>(go).GetComponent <Card>();
            card.index         = i;
            this._initCards[i] = card;

            card.transform.SetParent(Tools.FindChild2("bottomLayer", this.gameObject).transform, false);
            card.transform.localPosition = new Vector3(230 + i * 130, 75, 0);
        }
        this.testBtnChange.onClick.AddListener(() => {
            this.testBtn.SetActive(!this.testBtn.activeSelf);
        });

        this.voiceBtn.onClick.AddListener(() => {
            this.testCanvas.SetActive(!this.testCanvas.activeSelf);
        });
    }
        public void ResLoaderTest()
        {
            ResFactory.AddResCreator <TestResCreator>();

            // 测试
            var resLoader = ResLoader.Allocate();

            var resSearchKeys = ResSearchKeys.Allocate("test://icon_texture", null, typeof(Texture2D));

            var iconTextureRes = resLoader.LoadResSync(resSearchKeys);

            Assert.IsTrue(iconTextureRes is TestRes);
            Assert.AreEqual(1, iconTextureRes.RefCount);
            Assert.AreEqual(ResState.Ready, iconTextureRes.State);

            resLoader.Recycle2Cache();

            Assert.AreEqual(0, iconTextureRes.RefCount);
            Assert.AreEqual(ResState.Waiting, iconTextureRes.State);

            resLoader = null;
        }
Exemple #19
0
    public GameObject addEffect(string res, Vector2D position, float scale = 1)
    {
        GameObject go = ResFactory.getCacheEffect(res, this.clientRunTime);

        if (null == go)
        {
            MediatorSystem.log("effectLost", res);
            Debug.Log("没有资源" + res);
            return(go);
        }
        go.transform.SetParent(this.effectLayer, false);
        go.transform.localPosition = ViewUtils.logicToScene(position, this.clientRunTime.mapData.earthRadius, this.clientRunTime.mapData);

        Vector3 v = new Vector3(this.transform.position.x, go.transform.position.y, this.transform.position.z);

        go.transform.LookAt(v);
        if (1 != scale)
        {
            GameObjectScaler.Scale(go, scale);
        }
        return(go);
    }
Exemple #20
0
    public static GameObject getCacheEffect(string name, ClientRunTime clientRunTime, bool visible = true)
    {
        GameObject result = null;

        if (!effectMap.ContainsKey(name))
        {
            effectMap[name] = new List <GameObject>();
        }

        List <GameObject> gameObjects = effectMap[name];

        if (gameObjects.Count > 0)
        {
            int len = gameObjects.Count - 1;
            result = gameObjects[len];
            gameObjects.RemoveAt(len);
        }
        else
        {
            result = ResFactory.getEffect(name);
            if (null == result)
            {
                Debug.Log("没有资源" + name);
            }
            result = ResFactory.createObject <GameObject>(result);
            result.AddComponent <CacheEffect>().clientRunTime = clientRunTime;
            result.name = name;
            AutoDestroy auto = result.GetComponent <AutoDestroy>();
            if (auto != null)
            {
                auto.onlyDeactivate = true;
            }
        }
        if (visible)
        {
            result.gameObject.SetActive(true);        //有些要延迟生效 就不给他visible等于true。
        }
        return(result);
    }
Exemple #21
0
    private void updateBtn()
    {
        while (this.selects.Count != 0)
        {
            Destroy(this.selects[0].gameObject); this.selects.RemoveAt(0);
        }
        ;
        try {
            string str = this.readFile();
            if (str == "")
            {
                return;
            }

            FightMain.ccccc = "";

            Dictionary <string, object> dic = JsonMapper.ToObject <Dictionary <string, object> >(str);

            foreach (string key in dic.Keys)
            {
                L_Button btn = ResFactory.createObject <L_Button>(this.select_btn);
                ((RectTransform)btn.transform).sizeDelta = new Vector2(80, 50);
                btn.transform.SetParent(this.transform);
                btn.transform.localPosition = new Vector3(-52 + (this.selects.Count % 2) * 100, 69 + (int)(this.selects.Count / 2) * 100, 0);
                btn.SetText(key);
                this.selects.Add(btn);

                new TestSelecteItem(key, btn).addListener("change", (e) => {
                    string uid    = e.data.ToString().Split('_')[0];
                    int teamIndex = Convert.ToInt32(e.data.ToString().Split('_')[1]);
                    FightMain.instance.autoRunClient.startFight((object[])dic[uid], uid, teamIndex, ConfigConstant.MODE_TEST_WATCH);
                });
            }
        } catch (Exception e) {
            this.logDebug("解析错误");
        }
    }
Exemple #22
0
 /// 获得一个物体的边缘提示GO
 public GameObject getEdgeHintGameObject(int index)
 {
     return(ResFactory.createObject <GameObject>(prefabs[index]));
 }
 protected override TeamBall createBall()
 {
     return(ResFactory.createObject <GameObject>(ResFactory.loadPrefab("radishBall")).GetComponent <RadishBall>());
 }
Exemple #24
0
 protected virtual TeamBall createBall()
 {
     return(ResFactory.createObject <GameObject>(ResFactory.getOther("teamBall")).GetComponent <TeamBall>());
 }
Exemple #25
0
 public virtual void clear()
 {
     this._map.removeClientView(this);
     ResFactory.Destroy(this.gameObject);
     this._cleared = true;
 }
Exemple #26
0
        public ControlUnit(Processor processor)
        {
            this.InstructionMap = new Dictionary<byte, Instruction>();
            this.BigInstructionMap = new Dictionary<ushort, BigInstruction>();
            this.Processor = processor;
            
            this.InstructionMap.Add(AdcAA.OPCODE, new AdcAA(processor));
            this.InstructionMap.Add(AdcAB.OPCODE, new AdcAB(processor));
            this.InstructionMap.Add(AdcAC.OPCODE, new AdcAC(processor));
            this.InstructionMap.Add(AdcAD.OPCODE, new AdcAD(processor));
            this.InstructionMap.Add(AdcAE.OPCODE, new AdcAE(processor));
            this.InstructionMap.Add(AdcAH.OPCODE, new AdcAH(processor));
            this.InstructionMap.Add(AdcAHl.OPCODE, new AdcAHl(processor));
            this.InstructionMap.Add(AdcAL.OPCODE, new AdcAL(processor));

            this.InstructionMap.Add(AddAA.OPCODE, new AddAA(processor));
            this.InstructionMap.Add(AddAB.OPCODE, new AddAB(processor));
            this.InstructionMap.Add(AddAC.OPCODE, new AddAC(processor));
            this.InstructionMap.Add(AddAD.OPCODE, new AddAD(processor));
            this.InstructionMap.Add(AddAE.OPCODE, new AddAE(processor));
            this.InstructionMap.Add(AddAH.OPCODE, new AddAH(processor));
            this.InstructionMap.Add(AddAHl.OPCODE, new AddAHl(processor));
            this.InstructionMap.Add(AddAL.OPCODE, new AddAL(processor));
            this.InstructionMap.Add(AddAN.OPCODE, new AddAN(processor));
            this.InstructionMap.Add(AddHlBc.OPCODE, new AddHlBc(processor));
            this.InstructionMap.Add(AddHlDe.OPCODE, new AddHlDe(processor));
            this.InstructionMap.Add(AddHlHl.OPCODE, new AddHlHl(processor));
            this.InstructionMap.Add(AddHlSp.OPCODE, new AddHlSp(processor));

            this.InstructionMap.Add(AndA.OPCODE, new AndA(processor));
            this.InstructionMap.Add(AndB.OPCODE, new AndB(processor));
            this.InstructionMap.Add(AndC.OPCODE, new AndC(processor));
            this.InstructionMap.Add(AndD.OPCODE, new AndD(processor));
            this.InstructionMap.Add(AndE.OPCODE, new AndE(processor));
            this.InstructionMap.Add(AndH.OPCODE, new AndH(processor));
            this.InstructionMap.Add(AndL.OPCODE, new AndL(processor));
            this.InstructionMap.Add(AndHl.OPCODE, new AndHl(processor));
            this.InstructionMap.Add(AndN.OPCODE, new AndN(processor));

            this.InstructionMap.Add(CallNn.OPCODE, new CallNn(processor));

            this.InstructionMap.Add(CpA.OPCODE, new CpA(processor));
            this.InstructionMap.Add(CpB.OPCODE, new CpB(processor));
            this.InstructionMap.Add(CpC.OPCODE, new CpC(processor));
            this.InstructionMap.Add(CpD.OPCODE, new CpD(processor));
            this.InstructionMap.Add(CpE.OPCODE, new CpE(processor));
            this.InstructionMap.Add(CpH.OPCODE, new CpH(processor));
            this.InstructionMap.Add(CpHl.OPCODE, new CpHl(processor));
            this.InstructionMap.Add(CpL.OPCODE, new CpL(processor));
            this.InstructionMap.Add(CpN.OPCODE, new CpN(processor));

            this.InstructionMap.Add(Cpl.OPCODE, new Cpl(processor));

            this.InstructionMap.Add(DecA.OPCODE, new DecA(processor));
            this.InstructionMap.Add(DecB.OPCODE, new DecB(processor));
            this.InstructionMap.Add(DecBc.OPCODE, new DecBc(processor));
            this.InstructionMap.Add(DecC.OPCODE, new DecC(processor));
            this.InstructionMap.Add(DecD.OPCODE, new DecD(processor));
            this.InstructionMap.Add(DecDe.OPCODE, new DecDe(processor));
            this.InstructionMap.Add(DecE.OPCODE, new DecE(processor));
            this.InstructionMap.Add(DecH.OPCODE, new DecH(processor));
            this.InstructionMap.Add(DecHl.OPCODE, new DecHl(processor));
            this.InstructionMap.Add(DecHl2.OPCODE, new DecHl2(processor));
            this.InstructionMap.Add(DecL.OPCODE, new DecL(processor));
            this.InstructionMap.Add(DecSp.OPCODE, new DecSp(processor));

            this.InstructionMap.Add(Di.OPCODE, new Di(processor));

            this.InstructionMap.Add(Ei.OPCODE, new Ei(processor));

            this.InstructionMap.Add(IncA.OPCODE, new IncA(processor));
            this.InstructionMap.Add(IncB.OPCODE, new IncB(processor));
            this.InstructionMap.Add(IncBc.OPCODE, new IncBc(processor));
            this.InstructionMap.Add(IncC.OPCODE, new IncC(processor));
            this.InstructionMap.Add(IncD.OPCODE, new IncD(processor));
            this.InstructionMap.Add(IncDe.OPCODE, new IncDe(processor));
            this.InstructionMap.Add(IncE.OPCODE, new IncE(processor));
            this.InstructionMap.Add(IncH.OPCODE, new IncH(processor));
            this.InstructionMap.Add(IncHl.OPCODE, new IncHl(processor));
            this.InstructionMap.Add(IncHl2.OPCODE, new IncHl2(processor));
            this.InstructionMap.Add(IncL.OPCODE, new IncL(processor));
            this.InstructionMap.Add(IncSp.OPCODE, new IncSp(processor));

            this.InstructionMap.Add(JpCNn.OPCODE, new JpCNn(processor));
            this.InstructionMap.Add(JpHl.OPCODE, new JpHl(processor));
            this.InstructionMap.Add(JpNcNn.OPCODE, new JpNcNn(processor));
            this.InstructionMap.Add(JpNn.OPCODE, new JpNn(processor));
            this.InstructionMap.Add(JpNzNn.OPCODE, new JpNzNn(processor));
            this.InstructionMap.Add(JpZNn.OPCODE, new JpZNn(processor));

            this.InstructionMap.Add(JrC.OPCODE, new JrC(processor));
            this.InstructionMap.Add(JrN.OPCODE, new JrN(processor));
            this.InstructionMap.Add(JrNc.OPCODE, new JrNc(processor));
            this.InstructionMap.Add(JrNz.OPCODE, new JrNz(processor));
            this.InstructionMap.Add(JrZ.OPCODE, new JrZ(processor));

            this.InstructionMap.Add(LdAA.OPCODE, new LdAA(processor));
            this.InstructionMap.Add(LdAB.OPCODE, new LdAB(processor));
            this.InstructionMap.Add(LdABc.OPCODE, new LdABc(processor));
            this.InstructionMap.Add(LdAC.OPCODE, new LdAC(processor));
            this.InstructionMap.Add(LdAD.OPCODE, new LdAD(processor));
            this.InstructionMap.Add(LdADe.OPCODE, new LdADe(processor));
            this.InstructionMap.Add(LdAE.OPCODE, new LdAE(processor));
            this.InstructionMap.Add(LdAFF00N.OPCODE, new LdAFF00N(processor));
            this.InstructionMap.Add(LdAH.OPCODE, new LdAH(processor));
            this.InstructionMap.Add(LdAHl.OPCODE, new LdAHl(processor));
            this.InstructionMap.Add(LdAL.OPCODE, new LdAL(processor));
            this.InstructionMap.Add(LdAN.OPCODE, new LdAN(processor));
            this.InstructionMap.Add(LdANn.OPCODE, new LdANn(processor));
            this.InstructionMap.Add(LdBA.OPCODE, new LdBA(processor));
            this.InstructionMap.Add(LdBB.OPCODE, new LdBB(processor));
            this.InstructionMap.Add(LdBC.OPCODE, new LdBC(processor));
            this.InstructionMap.Add(LdBcA.OPCODE, new LdBcA(processor));
            this.InstructionMap.Add(LdBcNn.OPCODE, new LdBcNn(processor));
            this.InstructionMap.Add(LdBD.OPCODE, new LdBD(processor));
            this.InstructionMap.Add(LdBE.OPCODE, new LdBE(processor));
            this.InstructionMap.Add(LdBH.OPCODE, new LdBH(processor));
            this.InstructionMap.Add(LdBHl.OPCODE, new LdBHl(processor));
            this.InstructionMap.Add(LdBL.OPCODE, new LdBL(processor));
            this.InstructionMap.Add(LdBN.OPCODE, new LdBN(processor));
            this.InstructionMap.Add(LdCA.OPCODE, new LdCA(processor));
            this.InstructionMap.Add(LdCB.OPCODE, new LdCB(processor));
            this.InstructionMap.Add(LdCC.OPCODE, new LdCC(processor));
            this.InstructionMap.Add(LdCD.OPCODE, new LdCD(processor));
            this.InstructionMap.Add(LdCE.OPCODE, new LdCE(processor));
            this.InstructionMap.Add(LdCH.OPCODE, new LdCH(processor));
            this.InstructionMap.Add(LdCHl.OPCODE, new LdCHl(processor));
            this.InstructionMap.Add(LdCL.OPCODE, new LdCL(processor));
            this.InstructionMap.Add(LdCN.OPCODE, new LdCN(processor));
            this.InstructionMap.Add(LdDA.OPCODE, new LdDA(processor));
            this.InstructionMap.Add(LddAHl.OPCODE, new LddAHl(processor));
            this.InstructionMap.Add(LdDB.OPCODE, new LdDB(processor));
            this.InstructionMap.Add(LdDC.OPCODE, new LdDC(processor));
            this.InstructionMap.Add(LdDD.OPCODE, new LdDD(processor));
            this.InstructionMap.Add(LdDE.OPCODE, new LdDE(processor));
            this.InstructionMap.Add(LdDeA.OPCODE, new LdDeA(processor));
            this.InstructionMap.Add(LdDeNn.OPCODE, new LdDeNn(processor));
            this.InstructionMap.Add(LdDH.OPCODE, new LdDH(processor));
            this.InstructionMap.Add(LdDHl.OPCODE, new LdDHl(processor));
            this.InstructionMap.Add(LddHlA.OPCODE, new LddHlA(processor));
            this.InstructionMap.Add(LdDL.OPCODE, new LdDL(processor));
            this.InstructionMap.Add(LdDN.OPCODE, new LdDN(processor));
            this.InstructionMap.Add(LdEA.OPCODE, new LdEA(processor));
            this.InstructionMap.Add(LdEB.OPCODE, new LdEB(processor));
            this.InstructionMap.Add(LdEC.OPCODE, new LdEC(processor));
            this.InstructionMap.Add(LdED.OPCODE, new LdED(processor));
            this.InstructionMap.Add(LdEE.OPCODE, new LdEE(processor));
            this.InstructionMap.Add(LdEH.OPCODE, new LdEH(processor));
            this.InstructionMap.Add(LdEHl.OPCODE, new LdEHl(processor));
            this.InstructionMap.Add(LdEL.OPCODE, new LdEL(processor));
            this.InstructionMap.Add(LdEN.OPCODE, new LdEN(processor));
            this.InstructionMap.Add(LdFF00CA.OPCODE, new LdFF00CA(processor));
            this.InstructionMap.Add(LdFF00NA.OPCODE, new LdFF00NA(processor));
            this.InstructionMap.Add(LdHA.OPCODE, new LdHA(processor));
            this.InstructionMap.Add(LdHB.OPCODE, new LdHB(processor));
            this.InstructionMap.Add(LdHC.OPCODE, new LdHC(processor));
            this.InstructionMap.Add(LdHD.OPCODE, new LdHD(processor));
            this.InstructionMap.Add(LdHE.OPCODE, new LdHE(processor));
            this.InstructionMap.Add(LdHH.OPCODE, new LdHH(processor));
            this.InstructionMap.Add(LdHHl.OPCODE, new LdHHl(processor));
            this.InstructionMap.Add(LdHL.OPCODE, new LdHL(processor));
            this.InstructionMap.Add(LdHlA.OPCODE, new LdHlA(processor));
            this.InstructionMap.Add(LdHlN.OPCODE, new LdHlN(processor));
            this.InstructionMap.Add(LdHlNn.OPCODE, new LdHlNn(processor));
            this.InstructionMap.Add(LdHN.OPCODE, new LdHN(processor));
            this.InstructionMap.Add(LdiAHl.OPCODE, new LdiAHl(processor));
            this.InstructionMap.Add(LdiHlA.OPCODE, new LdiHlA(processor));
            this.InstructionMap.Add(LdLA.OPCODE, new LdLA(processor));
            this.InstructionMap.Add(LdLB.OPCODE, new LdLB(processor));
            this.InstructionMap.Add(LdLC.OPCODE, new LdLC(processor));
            this.InstructionMap.Add(LdLD.OPCODE, new LdLD(processor));
            this.InstructionMap.Add(LdLE.OPCODE, new LdLE(processor));
            this.InstructionMap.Add(LdLH.OPCODE, new LdLH(processor));
            this.InstructionMap.Add(LdLHl.OPCODE, new LdLHl(processor));
            this.InstructionMap.Add(LdLL.OPCODE, new LdLL(processor));
            this.InstructionMap.Add(LdLN.OPCODE, new LdLN(processor));
            this.InstructionMap.Add(LdNnA.OPCODE, new LdNnA(processor));
            this.InstructionMap.Add(LdSpNn.OPCODE, new LdSpNn(processor));

            this.InstructionMap.Add(Nop.OPCODE, new Nop(processor));

            this.InstructionMap.Add(OrA.OPCODE, new OrA(processor));
            this.InstructionMap.Add(OrB.OPCODE, new OrB(processor));
            this.InstructionMap.Add(OrC.OPCODE, new OrC(processor));
            this.InstructionMap.Add(OrD.OPCODE, new OrD(processor));
            this.InstructionMap.Add(OrE.OPCODE, new OrE(processor));
            this.InstructionMap.Add(OrH.OPCODE, new OrH(processor));
            this.InstructionMap.Add(OrHl.OPCODE, new OrHl(processor));
            this.InstructionMap.Add(OrL.OPCODE, new OrL(processor));
            this.InstructionMap.Add(OrN.OPCODE, new OrN(processor));
            
            this.InstructionMap.Add(PopAf.OPCODE, new PopAf(processor));
            this.InstructionMap.Add(PopBc.OPCODE, new PopBc(processor));
            this.InstructionMap.Add(PopDe.OPCODE, new PopDe(processor));
            this.InstructionMap.Add(PopHl.OPCODE, new PopHl(processor));

            this.InstructionMap.Add(PushAf.OPCODE, new PushAf(processor));
            this.InstructionMap.Add(PushBc.OPCODE, new PushBc(processor));
            this.InstructionMap.Add(PushDe.OPCODE, new PushDe(processor));
            this.InstructionMap.Add(PushHl.OPCODE, new PushHl(processor));

            this.InstructionMap.Add(Ret.OPCODE, new Ret(processor));
            this.InstructionMap.Add(RetC.OPCODE, new RetC(processor));
            this.InstructionMap.Add(Reti.OPCODE, new Reti(processor));
            this.InstructionMap.Add(RetNc.OPCODE, new RetNc(processor));
            this.InstructionMap.Add(RetNz.OPCODE, new RetNz(processor));
            this.InstructionMap.Add(RetZ.OPCODE, new RetZ(processor));
            
            this.InstructionMap.Add(Rlca.OPCODE, new Rlca(processor));

            this.InstructionMap.Add(Rst28.OPCODE, new Rst28(processor));
            
            this.InstructionMap.Add(SubA.OPCODE, new SubA(processor));
            this.InstructionMap.Add(SubB.OPCODE, new SubB(processor));
            this.InstructionMap.Add(SubC.OPCODE, new SubC(processor));
            this.InstructionMap.Add(SubD.OPCODE, new SubD(processor));
            this.InstructionMap.Add(SubE.OPCODE, new SubE(processor));
            this.InstructionMap.Add(SubH.OPCODE, new SubH(processor));
            this.InstructionMap.Add(SubHl.OPCODE, new SubHl(processor));
            this.InstructionMap.Add(SubL.OPCODE, new SubL(processor));
            this.InstructionMap.Add(SubN.OPCODE, new SubN(processor));
            
            this.InstructionMap.Add(XorA.OPCODE, new XorA(processor));
            this.InstructionMap.Add(XorB.OPCODE, new XorB(processor));
            this.InstructionMap.Add(XorC.OPCODE, new XorC(processor));
            this.InstructionMap.Add(XorD.OPCODE, new XorD(processor));
            this.InstructionMap.Add(XorE.OPCODE, new XorE(processor));
            this.InstructionMap.Add(XorH.OPCODE, new XorH(processor));
            this.InstructionMap.Add(XorHl.OPCODE, new XorHl(processor));
            this.InstructionMap.Add(XorL.OPCODE, new XorL(processor));
            this.InstructionMap.Add(XorN.OPCODE, new XorN(processor));

            var bitFactory = new BitFactory(this.Processor);
            bitFactory.Populate(this.BigInstructionMap);
            
            var resFactory = new ResFactory(this.Processor);
            resFactory.Populate(this.BigInstructionMap);
            
            var setFactory = new SetFactory(this.Processor);
            setFactory.Populate(this.BigInstructionMap);

            this.BigInstructionMap.Add(SwapA.OPCODE, new SwapA(processor));

            this.BigInstructionMap.Add(SlaA.OPCODE, new SlaA(processor));
            this.BigInstructionMap.Add(SlaB.OPCODE, new SlaB(processor));
            this.BigInstructionMap.Add(SlaC.OPCODE, new SlaC(processor));
            this.BigInstructionMap.Add(SlaD.OPCODE, new SlaD(processor));
            this.BigInstructionMap.Add(SlaE.OPCODE, new SlaE(processor));
            this.BigInstructionMap.Add(SlaH.OPCODE, new SlaH(processor));
            this.BigInstructionMap.Add(SlaHl.OPCODE, new SlaHl(processor));
            this.BigInstructionMap.Add(SlaL.OPCODE, new SlaL(processor));
            
            this.BigInstructionMap.Add(SrlA.OPCODE, new SrlA(processor));
            this.BigInstructionMap.Add(SrlB.OPCODE, new SrlB(processor));
            this.BigInstructionMap.Add(SrlC.OPCODE, new SrlC(processor));
            this.BigInstructionMap.Add(SrlD.OPCODE, new SrlD(processor));
            this.BigInstructionMap.Add(SrlE.OPCODE, new SrlE(processor));
            this.BigInstructionMap.Add(SrlH.OPCODE, new SrlH(processor));
            this.BigInstructionMap.Add(SrlHl.OPCODE, new SrlHl(processor));
            this.BigInstructionMap.Add(SrlL.OPCODE, new SrlL(processor));
        }
Exemple #27
0
    public override void init()
    {
        this.mainScale = Convert.ToSingle(((Dictionary <string, object>)ConfigConstant.scoreConfig[this._playerEntity.fightResult.scoreLevel])["mainScale"]);
        this.avatar    = ResFactory.createObject <AvatarView>(ResFactory.instance.avatar);
        this.avatar.init(Tools.FindChild2("ship", this.skewBody.gameObject).transform, this._playerEntity);
        base.init();


        /****************************加入边界************************/
        this.scene.edgeHintController.addFightObject(this._playerEntity.teamIndex == this.clientRunTime.teamIndex ? 1 : 2, this._fightEntity);
        /****************************名字************************/
        //Biggo修改
        this.nameText.text  = this._playerEntity.name;
        this.nameText.color = this._playerEntity.getTeamColor(0);
        ResFactory.setHeadSprite(this._playerEntity.headUrl, Tools.FindChild2("personEarth/Canvas/faceImage/Image", this.gameObject).GetComponent <Image>(), this._playerEntity.uid);
        /****************************outLine************************/
        Tools.FindChild2("personEarth/Canvas/nameText", this.gameObject).GetComponent <Outline>().effectColor = this._playerEntity.getTeamColor(1);
        /****************************frameImage************************/
        Tools.FindChild2("personEarth/Canvas/frameImage", this.gameObject).GetComponent <Image>().color = this._playerEntity.getTeamColor(2);
        /****************************装备************************/
        for (int i = 0, len = ConfigConstant.PART_COUNT; i < len; i++)
        {
            this.parts.Add(new PartSlider(this, i));
        }
        this.shipEntryTween(true);
        /****************************事件************************/
        //TODO:这个是否要与callView  dead进行融合???
        this._fightEntity.addListener(EventConstant.ALIVED, (e) => {
            this.gameObject.SetActive(this._fightEntity.alived);
            this.changeMove(1);
            if (!this._fightEntity.alived)
            {
                //死亡了。。。
                this.clientRunTime.addEffect("bangDead", this._fightEntity.position);
            }
            else
            {
                this.avatar.reset();
                this.shipEntryTween(true);
                this.clientRunTime.addEffect("bangBorn", this._fightEntity.position);
                for (int i = 0; i < ConfigConstant.PART_COUNT; i++)
                {
                    this.parts[i].updatePart();
                }
            }
        });

        this._playerEntity.addListener(EventConstant.LEVEL_CHANGE, (MainEvent e) => {
            this.mainScale = Convert.ToSingle(((Dictionary <string, object>)ConfigConstant.scoreConfig[this._playerEntity.fightResult.scoreLevel])["mainScale"]);
            this.shipEntryTween(false);
            Dictionary <string, object> scoreDic = (Dictionary <string, object>)e.data;
            if ((int)scoreDic["newLevel"] > (int)scoreDic["oldLevel"])
            {
                this.addEffect("bangScore");
                this.doAvatarAnimation("score");
            }
        });

        this._playerEntity.addListener(EventConstant.KILL_PLAYER, (MainEvent e) => {
            List <ClientPlayerEntity> players = (List <ClientPlayerEntity>)e.data;
            this.scene.addKillRadio(players[0], players[1]);
        });

        this.gameObject.SetActive(this._fightEntity.alived);
    }
    ///弹出并显示一条播报
    public void popRadio()
    {
        clearTween();
        if (radiolist.Count > 0)
        {
            LTDescr ltd;


            currentRadio = radiolist [0];
            radiolist.RemoveAt(0);
            currentRadioTime = 0;
            //temp
//			currentRadio.scale = 2f;

            //首阶段显现时间
            float timeApper = 0.2f / currentRadio.scale;
            //次阶段缓动动画时间
            float timeEnter = 0.1f;
            //第三阶段缓动动画时间
            float timeNext = 0.2f;
            //最后阶段缓动动画时间
            float timeFinish = 0.2f;

            Color outlineColor;
            //更新双方和文字
            if (currentRadio.player1 != null)
            {
                player1FaceImage.gameObject.SetActive(true);
                player1FrameImage.gameObject.SetActive(true);
                ResFactory.setHeadSprite(currentRadio.player1.headUrl, player1FaceImage, currentRadio.player1.uid);
                player1FrameImage.color = currentRadio.player1.getTeamColor(2);
//				lineImage.color = currentRadio.player1.getTeamColor (2);

                //头像偏移
                ltd           = LeanTween.moveLocalX(player1FrameImage.gameObject, player1LocalPosition.x + offsetTween, timeEnter);
                ltd.tweenType = LeanTweenType.easeOutSine;
                ltd.delay     = timeApper * 0.5f;

                outlineColor = currentRadio.player1.getTeamColor(2);

                bgImage.transform.localPosition = bgImagePosition0;
                bgInnerImage.gameObject.SetActive(false);
                radioText.rectTransform.sizeDelta = radioTextSizeDelta0;
            }
            else
            {
                //没有主动玩家,一般性播报
                player1FaceImage.gameObject.SetActive(false);
                player1FrameImage.gameObject.SetActive(false);

                outlineColor = currentRadio.color;

                bgImage.transform.localPosition = bgImagePosition1;
                bgInnerImage.gameObject.SetActive(true);
                radioText.rectTransform.sizeDelta = radioTextSizeDelta1;
            }

            if (currentRadio.player2 != null)
            {
                player2FaceImage.gameObject.SetActive(true);
                player2FrameImage.gameObject.SetActive(true);
                ResFactory.setHeadSprite(currentRadio.player2.headUrl, player2FaceImage, currentRadio.player2.uid);
                player2FrameImage.color = currentRadio.player2.getTeamColor(2);

                ltd           = LeanTween.moveLocalX(player2FrameImage.gameObject, player2LocalPosition.x - offsetTween, timeEnter);
                ltd.tweenType = LeanTweenType.easeOutSine;
                ltd.delay     = timeApper * 0.5f;

                //击杀红叉图片缩放,透明显现变化颜色
                float   scale = 3f;
                Vector3 v3    = new Vector3(scale, scale, scale);
                deadImage.transform.localScale = v3;
                ltd           = LeanTween.scale(deadImage.gameObject, deadLocalScale, timeFinish);
                ltd.tweenType = LeanTweenType.easeOutBack;
                ltd.delay     = timeApper + timeEnter + timeNext * 0.5f;

                deadImage.color = colorStart;
                ltd             = LeanTween.value(this.gameObject, (Color color) =>
                {
                    deadImage.color = color;
                },
                                                  colorStart,
                                                  Color.white,
                                                  timeFinish * 0.5f
                                                  );
                ltd.tweenType = LeanTweenType.easeOutSine;
                ltd.delay     = timeApper + timeEnter + timeNext * 0.5f;
            }
            else
            {
                player2FaceImage.gameObject.SetActive(false);
                player2FrameImage.gameObject.SetActive(false);
            }

            //文字和外发光
            radioTextOutline.effectColor = outlineColor;
            radioText.text = currentRadio.info;

            //音效
            if (currentRadio.player1 != null && currentRadio.player2 != null)
            {
                int player1Type = currentRadio.player1.teamType;
                int player2Type = currentRadio.player2.teamType;
                if (player1Type == 0)
                {
                    playVoice(currentRadio.voiceIDo);
                }
                else if (player2Type == 0)
                {
                    playVoice(currentRadio.voiceDoMe);
                }
                else if (player1Type == 1)
                {
                    playVoice(currentRadio.voiceAllyDo);
                }
                else if (player1Type == 2)
                {
                    playVoice(currentRadio.voiceEnermyDo);
                }
                else
                {
                    playVoice(currentRadio.voice);
                }
            }
            else
            {
                playVoice(currentRadio.voice);
            }

//			Vector3 position;
//			if (false && currentRadio.cardId != null) {
//				//有击杀卡片展示
//				cardImage.gameObject.SetActive (true);
//				cardImage.sprite = ViewUtils.LoadSprite(currentRadio.cardId);
//
//				position = new Vector3();
//				position.x = -radioText.preferredWidth * 0.5f - 22f;
//				cardImage.transform.localPosition = position;
//
//				position = new Vector3();
//				position.x = 22f;
//				radioText.transform.localPosition = position;
//			} else {
            //无击杀卡片展示
//				cardImage.gameObject.SetActive (false);
//
//				position = new Vector3();
//				radioText.transform.localPosition = position;
//			}


            GameObject lightningGo       = null;
            Animator   lightningAnimator = null;
            if (currentRadio.lightningScale > 0)
            {
                if (currentRadio.player1 == null || currentRadio.player1.teamType <= 1)
                {
                    //蓝色闪电
                    lightningGo       = lightningGo1;
                    lightningAnimator = lightningAnimator1;
                }
                else
                {
                    //红色闪电
                    lightningGo       = lightningGo2;
                    lightningAnimator = lightningAnimator2;
                }
            }

            //击杀文字缩放
            if (currentRadio.scale > 1f)
            {
                float   scale1 = (currentRadio.scale - 1f) * 5 + 1;
                float   scale2 = (currentRadio.scale - 1f) * 2 + 1;
                Vector3 v3_1   = new Vector3(scale1, scale1, scale1);
                Vector3 v3_2   = new Vector3(scale2, scale2, scale2);

                radioText.transform.localScale = v3_1;

                ltd            = LeanTween.scale(radioText.gameObject, v3_2, timeEnter);
                ltd.delay      = timeApper * 0.5f;
                ltd.onComplete = () => {
                    LTDescr ltd_ = LeanTween.scale(radioText.gameObject, textLocalScale, timeNext);
                    ltd_.tweenType = LeanTweenType.easeOutBack;

                    if (lightningGo != null)
                    {
                        float   scale = currentRadio.lightningScale;
                        Vector3 v3    = new Vector3(scale, scale, scale);
                        LeanTween.delayedCall(timeEnter * 0.5f, () => {
                            //闪电
                            lightningAnimator.Play("play");
                        });
                    }
                };
                //透明显现
                radioText.color = colorStart;
                ltd             = LeanTween.value(this.gameObject, (Color color) =>
                {
                    radioText.color = color;
                },
                                                  colorStart,
                                                  Color.white,//player1Color
                                                  timeEnter
                                                  );
                ltd.delay = timeApper * 0.5f;
            }

            //整体透明显现
            ltd = LeanTween.value(this.gameObject, (float value) =>
            {
                canvasGroup.alpha = value;
            },
                                  canvasGroup.alpha,
                                  1,
                                  timeApper
                                  );
            ltd.onComplete = () => {
                isSwitch = false;
            };
        }
    }
Exemple #29
0
    public void init(string id, int type, PartAction partData, Transform parent, ClientPlayerEntity playerEntity, float scoreScale)
    {
        this.type          = type;
        this._playerEntity = playerEntity;
        this._map          = (ClientRunTime)this._playerEntity.map;
        //不同id 更换
        if (this.id != id)
        {
            this.id = id;
            if (null != this.gameObject)
            {
                LeanTween.cancel(this.gameObject);
                GameObject.Destroy(this.gameObject);
            }
            this.gameObject = ResFactory.getShip(id);
            //翅膀
            if (this.type == 1)
            {
                GameObject goLeft = ResFactory.createObject <GameObject>(this.gameObject);
                goLeft.name = "left";
                //右
                GameObject goRight = ResFactory.createObject <GameObject>(this.gameObject);
                goRight.transform.localScale = new Vector3(1, -1, 1);
                goRight.name = "right";

                this.gameObject = new GameObject();
                goLeft.transform.SetParent(this.gameObject.transform, false);
                goRight.transform.SetParent(this.gameObject.transform, false);
            }
            else
            {
                this.gameObject = ResFactory.createObject <GameObject>(this.gameObject);
            }
            this.gameObject.name = id;

            this.gameObject.transform.SetParent(parent, false);
            if (type == 5 - 1)
            {
                this.gameObject.transform.localPosition = new Vector3(0, 0, 1);
            }
            else
            {
                this.gameObject.transform.localPosition = new Vector3();
            }
            this._material = ViewUtils.getMaterial(this.gameObject, ViewConstant.SHIP_SHADER_NAME);
            ViewUtils.changeColor(this._material, (Dictionary <string, object>)ViewConstant.shipConfig[this._playerEntity.shipColorId]);
        }

        if (partData != this.partData)
        {
            this.resetPart(scoreScale, scoreScale, scoreScale);
        }
        //两个装备不等 直接重置装备。可以是同id替换


        if (null != partData && this.partData != partData)
        {
            //如果装备立刻启用的话 在一进入可能瞬间装备就生效了!
            if (partData.alived)
            {
                this.partStartHandler(null);
            }
            else
            {
                this._color          = ViewUtils.cloneColor(ViewConstant.SHADER_COLOR_WARM);
                this._material.color = this._color;
                ViewUtils.setEnable(this.gameObject, false);
                /*************************启用用装备******************************/
                partData.addListener(EventConstant.ALIVED, partStartHandler);
            }

            /*************************受伤闪红******************************/
            partData.addListener(EventConstant.HURT, (e) => {
                ViewUtils.colorInOutMaterial(this.gameObject, this._material, ViewConstant.SHADER_COLOR_RED, ViewConstant.SHADER_COLOR_STANDARD, 0.05f, 0.3f);
            });
        }
        this.partData = partData;
    }
Exemple #30
0
 public ResFactory()
 {
     instance = this;
 }