Beispiel #1
0
 private void OnGetStartToFightRes(short state, StartToFightRes down)
 {
     if (state != 0)
     {
         StateManager.Instance.StateShow(state, 0);
         return;
     }
     if (down != null)
     {
         EventDispatcher.Broadcast(EventNames.OnGetStartToFightRes);
         if (BallElement.Instance.lastBlockChche.get_Length() != 0)
         {
             Transform       transform = BallElement.Instance.get_transform().FindChild(BallElement.Instance.lastBlockChche);
             BallElementItem component = transform.GetComponent <BallElementItem>();
             component.isActor = false;
         }
         BallElement.Instance.shouldChangePosImmediately = true;
         InstanceManager.ChangeInstanceManager(down.copyId, false);
         if (this.actionSendFightReq != null)
         {
             this.actionSendFightReq.Invoke();
             this.actionSendFightReq = null;
         }
     }
 }
Beispiel #2
0
    public void RefreshBallIcons()
    {
        if (!this.lastBlockChche.Equals(ElementInstanceManager.Instance.m_elementCopyLoginPush.lastBlock))
        {
            if (this.lastBlockChche.get_Length() != 0)
            {
                Transform       transform = base.get_transform().FindChild(this.lastBlockChche);
                BallElementItem component = transform.GetComponent <BallElementItem>();
                component.isActor = false;
            }
            Transform       transform2 = base.get_transform().FindChild(ElementInstanceManager.Instance.m_elementCopyLoginPush.lastBlock);
            BallElementItem component2 = transform2.GetComponent <BallElementItem>();
            component2.isActor = true;
            this.transformActor.set_parent(transform2);
            this.transformActor.set_localRotation(Quaternion.Euler(90f, 0f, 0f));
            this.transformActor.set_localScale(new Vector3(0.1f, 0.1f, 0.1f));
            Transform transform3 = this.transformActor.FindChild("Actor").FindChild("root");
            Transform transform4 = this.transformActor.FindChild("Actor").FindChild("front");
            Vector3   vector     = transform2.get_position() - transform3.get_position();
            Vector3   vector2    = transform4.get_position() - transform3.get_position();
            float     num        = Vector3.Dot(vector.get_normalized(), vector2.get_normalized());
            float     num2       = Mathf.Acos(num);
            num2 *= 57.2957764f;
            Vector3 vector3 = Vector3.Cross(vector, vector2);
            float   num3    = Vector3.Distance(base.get_transform().get_position(), transform3.get_position() + vector3);
            float   num4    = Vector3.Distance(base.get_transform().get_position(), transform3.get_position());
            if (num3 > num4)
            {
                num2 = -num2;
            }
            Transform expr_1AD = this.transformActor.FindChild("Actor");
            expr_1AD.set_localRotation(expr_1AD.get_localRotation() * Quaternion.Euler(0f, 0f, num2));
            if (this.shouldChangePosImmediately)
            {
                this.shouldChangePosImmediately = false;
                ElementInstanceManager.Instance.m_isActorMoving = false;
                this.transformActor.set_position(transform2.get_position());
            }
            else
            {
                ElementInstanceManager.Instance.m_isActorMoving = true;
                this.actorPosFrom = transform3.get_position();
                this.actorPosTo   = transform2.get_position();
            }
            this.lastBlockChche = ElementInstanceManager.Instance.m_elementCopyLoginPush.lastBlock;
        }
        TimerHeap.DelTimer(this.timeCalNear);
        uint start = 0u;

        if (this.timeCalNear != 0u)
        {
            start = 200u;
        }
        this.timeCalNear = TimerHeap.AddTimer(start, 0, delegate
        {
            List <BlockInfo> activateBlocks = ElementInstanceManager.Instance.m_elementCopyLoginPush.activateBlocks;
            Material material   = BallElement.GetAssetByName("MaterialBallItemPassBy", typeof(Material)) as Material;
            Material material2  = BallElement.GetAssetByName("MaterialBallItem", typeof(Material)) as Material;
            Material material3  = BallElement.GetAssetByName("MaterialBallItemPassByPentagon", typeof(Material)) as Material;
            Material material4  = BallElement.GetAssetByName("MaterialBallItem_Pentagon", typeof(Material)) as Material;
            Material material5  = BallElement.GetAssetByName("MaterialBallItemNearPentagon", typeof(Material)) as Material;
            Material material6  = BallElement.GetAssetByName("MaterialBallItemNear", typeof(Material)) as Material;
            Material material7  = BallElement.GetAssetByName("MaterialBallItemNearPassBy", typeof(Material)) as Material;
            Material material8  = BallElement.GetAssetByName("MaterialBallItemNearPentagonPassBy", typeof(Material)) as Material;
            Material material9  = BallElement.GetAssetByName("MaterialBallItemMineNear", typeof(Material)) as Material;
            Material material10 = BallElement.GetAssetByName("MaterialBallItemMine", typeof(Material)) as Material;
            for (int i = 0; i < this.ballLight.get_childCount(); i++)
            {
                if (this.ballLight.GetChild(i).get_gameObject().get_activeSelf())
                {
                    this.ballLight.GetChild(i).get_gameObject().SetActive(false);
                }
            }
            List <string> around = DataReader <YBanKuaiSuoYin> .Get(ElementInstanceManager.Instance.m_elementCopyLoginPush.lastBlock).around;
            for (int j = 0; j < activateBlocks.get_Count(); j++)
            {
                BlockInfo bi               = activateBlocks.get_Item(j);
                Transform transform5       = base.get_transform().FindChild(bi.blockId);
                BallElementItem component3 = transform5.GetComponent <BallElementItem>();
                Material mat;
                if (this.listPentagon.Find((YBanKuaiSuoYin a) => a.ballId.Equals(bi.blockId)) != null)
                {
                    if ((around.Contains(bi.blockId) && bi.incidentType != RandomIncidentType.IncidentType.ROADBLOCK) || component3.isActor)
                    {
                        if (bi.isChallenge)
                        {
                            mat = material8;
                        }
                        else
                        {
                            mat = material5;
                        }
                    }
                    else if (bi.isChallenge)
                    {
                        mat = material3;
                    }
                    else
                    {
                        mat = material4;
                    }
                }
                else if ((around.Contains(bi.blockId) && bi.incidentType != RandomIncidentType.IncidentType.ROADBLOCK) || component3.isActor)
                {
                    if (bi.isChallenge)
                    {
                        mat = material7;
                    }
                    else if (bi.incidentType == RandomIncidentType.IncidentType.MINE)
                    {
                        mat = material9;
                    }
                    else
                    {
                        mat = material6;
                    }
                }
                else if (bi.isChallenge)
                {
                    mat = material;
                }
                else if (bi.incidentType == RandomIncidentType.IncidentType.MINE)
                {
                    mat = material10;
                }
                else
                {
                    mat = material2;
                }
                Utils.SetShareMaterial(transform5.GetComponent <MeshRenderer>(), mat);
                if (component3.blockInfo != bi)
                {
                    component3.blockInfo = bi;
                    if (component3.gameObjectBlockInfo != null)
                    {
                        if (bi.incidentType == RandomIncidentType.IncidentType.PETPROPERTY || bi.incidentType == RandomIncidentType.IncidentType.PLAYERPROPERTY || bi.incidentType == RandomIncidentType.IncidentType.TOOL || bi.incidentType == RandomIncidentType.IncidentType.RECOVRYENERGY)
                        {
                            GameObject goInstantiate = Object.Instantiate <GameObject>(component3.gameObjectBlockInfo);
                            ResourceManager.SetInstantiateUIRef(goInstantiate, null);
                            goInstantiate.get_transform().set_parent(component3.gameObjectBlockInfo.get_transform().get_parent());
                            goInstantiate.get_transform().set_position(component3.gameObjectBlockInfo.get_transform().get_position());
                            goInstantiate.get_transform().set_localScale(component3.gameObjectBlockInfo.get_transform().get_localScale());
                            goInstantiate.get_transform().set_localRotation(component3.gameObjectBlockInfo.get_transform().get_localRotation());
                            TimerHeap.AddTimer(50u, 0, delegate
                            {
                                Object.Destroy(goInstantiate);
                            });
                        }
                        Object.Destroy(component3.gameObjectBlockInfo);
                    }
                    GameObject gameObject = null;
                    string name           = string.Empty;
                    string text           = string.Empty;
                    if (bi.incidentType == RandomIncidentType.IncidentType.MINE)
                    {
                        name       = DataReader <YKuangJingKu> .Get(bi.incidentTypeId).Model;
                        gameObject = (Object.Instantiate(AssetManager.AssetOfNoPool.LoadAssetNowNoAB(FileSystem.GetPathOfPrefab(name), typeof(Object))) as GameObject);
                        text       = DataReader <YKuangJingKu> .Get(bi.incidentTypeId).holdName;
                        ElementInstanceUI.Instance.SetInfoUnit(component3, text);
                    }
                    else if (bi.incidentType == RandomIncidentType.IncidentType.MONSTER)
                    {
                        name = DataReader <YGuaiWuKu> .Get(bi.incidentTypeId).Model;
                        if (bi.isChallenge)
                        {
                            gameObject = new GameObject("ElementEMPTY");
                        }
                        else
                        {
                            text       = DataReader <YGuaiWuKu> .Get(bi.incidentTypeId).Name;
                            gameObject = (Object.Instantiate(AssetManager.AssetOfNoPool.LoadAssetNowNoAB(FileSystem.GetPathOfPrefab(name), typeof(Object))) as GameObject);
                        }
                        ElementInstanceUI.Instance.SetInfoUnit(component3, text);
                    }
                    else if (bi.incidentType == RandomIncidentType.IncidentType.PETPROPERTY)
                    {
                        name = DataReader <YChongWuJiaChengKu> .Get(bi.incidentTypeId).Model;
                        if (bi.isChallenge)
                        {
                            gameObject = new GameObject("ElementEMPTY");
                        }
                        else
                        {
                            gameObject = (Object.Instantiate(AssetManager.AssetOfNoPool.LoadAssetNowNoAB(FileSystem.GetPathOfPrefab(name), typeof(Object))) as GameObject);
                            text       = DataReader <YChongWuJiaChengKu> .Get(bi.incidentTypeId).eventName;
                        }
                        ElementInstanceUI.Instance.SetInfoUnit(component3, text);
                    }
                    else if (bi.incidentType == RandomIncidentType.IncidentType.PLAYERPROPERTY)
                    {
                        name = DataReader <YJiaoSeJiaChengKu> .Get(bi.incidentTypeId).Model;
                        if (bi.isChallenge)
                        {
                            gameObject = new GameObject("ElementEMPTY");
                        }
                        else
                        {
                            gameObject = (Object.Instantiate(AssetManager.AssetOfNoPool.LoadAssetNowNoAB(FileSystem.GetPathOfPrefab(name), typeof(Object))) as GameObject);
                            text       = DataReader <YJiaoSeJiaChengKu> .Get(bi.incidentTypeId).eventName;
                        }
                        ElementInstanceUI.Instance.SetInfoUnit(component3, text);
                    }
                    else if (bi.incidentType == RandomIncidentType.IncidentType.ROADBLOCK)
                    {
                        name       = DataReader <YWanFaSheZhi> .Get("roadBlockModel").value;
                        gameObject = (Object.Instantiate(AssetManager.AssetOfNoPool.LoadAssetNowNoAB(FileSystem.GetPathOfPrefab(name), typeof(Object))) as GameObject);
                        ElementInstanceUI.Instance.SetInfoUnit(component3, GameDataUtils.GetChineseContent(502317, false));
                    }
                    else if (bi.incidentType == RandomIncidentType.IncidentType.TOOL || bi.incidentType == RandomIncidentType.IncidentType.RECOVRYENERGY)
                    {
                        name = DataReader <YDaoJuKu> .Get(bi.incidentTypeId).Model;
                        if (bi.isChallenge)
                        {
                            gameObject = new GameObject("ElementEMPTY");
                        }
                        else
                        {
                            gameObject = (Object.Instantiate(AssetManager.AssetOfNoPool.LoadAssetNowNoAB(FileSystem.GetPathOfPrefab(name), typeof(Object))) as GameObject);
                            text       = DataReader <YDaoJuKu> .Get(bi.incidentTypeId).holdName;
                        }
                        ElementInstanceUI.Instance.SetInfoUnit(component3, text);
                    }
                    else if (bi.incidentType == RandomIncidentType.IncidentType.EMPTY)
                    {
                        gameObject = new GameObject("ElementEMPTY");
                        ElementInstanceUI.Instance.SetInfoUnit(component3, string.Empty);
                    }
                    gameObject.get_transform().set_parent(transform5);
                    gameObject.get_transform().set_localPosition(new Vector3(0f, 0f, 0f));
                    gameObject.get_transform().set_localRotation(Quaternion.Euler(90f, 0f, 0f));
                    component3.gameObjectBlockInfo = gameObject;
                }
            }
            for (int k = 0; k < ElementInstanceManager.Instance.m_elementCopyLoginPush.mineBlockId.get_Count(); k++)
            {
                string text2               = ElementInstanceManager.Instance.m_elementCopyLoginPush.mineBlockId.get_Item(k);
                Transform transform6       = base.get_transform().FindChild(text2);
                BallElementItem component4 = transform6.GetComponent <BallElementItem>();
                if (!(component4.gameObjectBlockInfo != null))
                {
                    string value           = DataReader <YWanFaSheZhi> .Get("lockMineModel").value;
                    GameObject gameObject2 = Object.Instantiate(AssetManager.AssetOfNoPool.LoadAssetNowNoAB(FileSystem.GetPathOfPrefab(value), typeof(Object))) as GameObject;
                    ElementInstanceUI.Instance.SetInfoUnit(component4, GameDataUtils.GetChineseContent(502316, false));
                    gameObject2.get_transform().set_parent(transform6);
                    gameObject2.get_transform().set_localPosition(new Vector3(0f, 0f, 0f));
                    gameObject2.get_transform().set_localRotation(Quaternion.Euler(90f, 0f, 0f));
                    component4.gameObjectBlockInfo = gameObject2;
                }
            }
            for (int l = 0; l < this.listPentagon.get_Count(); l++)
            {
                YBanKuaiSuoYin yBanKuaiSuoYin = this.listPentagon.get_Item(l);
                if (base.get_transform().FindChild(yBanKuaiSuoYin.ballId).GetComponent <BallElementItem>().blockInfo == null)
                {
                    Utils.SetShareMaterial(base.get_transform().FindChild(yBanKuaiSuoYin.ballId).GetComponent <MeshRenderer>(), material4);
                }
            }
            this.RefreshMineFX();
        });
    }
Beispiel #3
0
    private void OnPointerUp(PointerEventData eventData)
    {
        if (ElementInstanceManager.Instance.m_isActorMoving)
        {
            return;
        }
        if (Vector2.Distance(this.onPointerDownPlace, eventData.get_position()) > 10f)
        {
            return;
        }
        Vector3 position = CamerasMgr.CameraUI.ScreenToWorldPoint(new Vector3(eventData.get_position().x, eventData.get_position().y, 0f));

        position.z = 0f;
        this.ImageLocate.set_position(position);
        position = this.ImageLocate.get_localPosition();
        Vector3 zero = Vector3.get_zero();
        float   num  = (float)CamerasMgr.Camera2RTCommon.get_pixelWidth();
        float   num2 = (float)CamerasMgr.Camera2RTCommon.get_pixelHeight();

        zero.x = (position.x + num / 2f) / num * num;
        zero.y = (position.y + num2 / 2f) / num2 * num2;
        zero.z = 0f;
        Ray        ray = CamerasMgr.Camera2RTCommon.ScreenPointToRay(zero);
        RaycastHit raycastHit;

        if (Physics.Raycast(ray, ref raycastHit, 1000f, -1))
        {
            BallElementItem bei = raycastHit.get_collider().get_gameObject().GetComponent <BallElementItem>();
            bei.DoOnClickAnimation();
            if (bei.blockInfo == null)
            {
                UIManagerControl.Instance.ShowToastText(GameDataUtils.GetChineseContent(502319, false));
                return;
            }
            List <string> around = DataReader <YBanKuaiSuoYin> .Get(ElementInstanceManager.Instance.m_elementCopyLoginPush.lastBlock).around;

            if (!around.Contains(bei.blockInfo.blockId))
            {
                UIManagerControl.Instance.ShowToastText(GameDataUtils.GetChineseContent(502267, false));
                return;
            }
            if (bei.isActor)
            {
                if (bei.blockInfo.incidentType == RandomIncidentType.IncidentType.MONSTER && !bei.blockInfo.isChallenge)
                {
                    TimerHeap.AddTimer(500u, 0, delegate
                    {
                        DialogBoxUIViewModel.Instance.ShowAsOKCancel(GameDataUtils.GetChineseContent(502304, false), GameDataUtils.GetChineseContent(502303, false), delegate
                        {
                        }, delegate
                        {
                            ElementInstanceManager.Instance.SendStartToFightReq(bei.blockInfo.blockId);
                        }, GameDataUtils.GetChineseContent(505113, false), GameDataUtils.GetChineseContent(505114, false), "button_orange_1", "button_yellow_1", null, true, true);
                    });
                }
                else if (bei.blockInfo.incidentType == RandomIncidentType.IncidentType.MINE && !bei.blockInfo.isChallenge)
                {
                    TimerHeap.AddTimer(500u, 0, delegate
                    {
                        DialogBoxUIViewModel.Instance.ShowAsOKCancel(GameDataUtils.GetChineseContent(502304, false), GameDataUtils.GetChineseContent(502303, false), delegate
                        {
                        }, delegate
                        {
                            ElementInstanceManager.Instance.SendStartToFightReq(bei.blockInfo.blockId);
                        }, GameDataUtils.GetChineseContent(505113, false), GameDataUtils.GetChineseContent(505114, false), "button_orange_1", "button_yellow_1", null, true, true);
                    });
                }
            }
            else if (bei.blockInfo.incidentType == RandomIncidentType.IncidentType.ROADBLOCK)
            {
                UIManagerControl.Instance.ShowToastText(GameDataUtils.GetChineseContent(502300, false));
            }
            else if ((bei.blockInfo.incidentType == RandomIncidentType.IncidentType.MONSTER || bei.blockInfo.incidentType == RandomIncidentType.IncidentType.MINE) && !bei.blockInfo.isChallenge)
            {
                if (ElementInstanceManager.Instance.CheckIsAround(bei.blockInfo.blockId))
                {
                    if (bei.blockInfo.incidentType == RandomIncidentType.IncidentType.MONSTER)
                    {
                        ElementInstanceMonsterMeet elementInstanceMonsterMeet = InstanceManagerUI.OpenElementInstanceMonsterMeet();
                        elementInstanceMonsterMeet.blockID = bei.blockInfo.blockId;
                        elementInstanceMonsterMeet.RefreshUI(bei.blockInfo.incidentTypeId);
                    }
                    else
                    {
                        ElementInstanceMineDetailUI elementInstanceMineDetailUI = UIManagerControl.Instance.OpenUI("ElementInstanceMineDetailUI", UINodesManager.NormalUIRoot, false, UIType.NonPush) as ElementInstanceMineDetailUI;
                        elementInstanceMineDetailUI.blockID = bei.blockInfo.blockId;
                        elementInstanceMineDetailUI.RefreshUI();
                    }
                }
                else
                {
                    UIManagerControl.Instance.ShowToastText(GameDataUtils.GetChineseContent(502307, false));
                }
            }
            else if (bei.blockInfo.incidentType == RandomIncidentType.IncidentType.MINE && bei.blockInfo.isChallenge && ElementInstanceManager.Instance.CheckIsAround(bei.blockInfo.blockId))
            {
                ElementInstanceMineDetailUI elementInstanceMineDetailUI2 = UIManagerControl.Instance.OpenUI("ElementInstanceMineDetailUI", UINodesManager.NormalUIRoot, false, UIType.NonPush) as ElementInstanceMineDetailUI;
                elementInstanceMineDetailUI2.blockID = bei.blockInfo.blockId;
                elementInstanceMineDetailUI2.RefreshUI();
            }
            else
            {
                ElementInstanceManager.Instance.SendExploreBlockReq(ElementInstanceManager.Instance.m_elementCopyLoginPush.lastBlock, raycastHit.get_collider().get_gameObject().get_name());
            }
        }
    }
Beispiel #4
0
 public void SetInfoUnit(BallElementItem ballitem, string text)
 {
 }