Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     Singleton = GameObject.Find ("Ground").GetComponent<Singleton> ();
     if(!useEmmiter){
         this.gameObject.GetComponentInChildren<ParticleSystem> ().Stop ();
     }
 }
Ejemplo n.º 2
0
        public static Singleton GetInstance()
        {
            if (_instance == null)
                _instance = new Singleton();

            return _instance;
        }
Ejemplo n.º 3
0
        // Publicza statyczna metoda za pomoca ktorej utworzymy referencje do obiekti
        public static Singleton UtworzObiektSingleton()
        {
            if(_singleton == null)
            _singleton = new Singleton();

            return _singleton;
        }
        public override void Prepare()
        {
            var singleton = new Singleton();

            Injector.SetResolver<ISingleton>(() => singleton);
            Injector.SetResolver<ITransient, Transient>();
            Injector.SetResolver<ICombined, Combined>();
        }
Ejemplo n.º 5
0
        public override void Prepare()
        {
            ISingleton singleton = new Singleton();

            container[typeof(ISingleton)] = () => singleton;
            container[typeof(ITransient)] = () => new Transient();
            container[typeof(ICombined)] = () => new Combined(singleton, new Transient());
        }
Ejemplo n.º 6
0
 public static Singleton Get()
 {
     if (self == null)
     {
         self = new Singleton();
     }
     return self;
 }
Ejemplo n.º 7
0
 // M2 通过方法来获取单例.这两个方法都可以
 public static Singleton GetInstance()
 {
     if (instance == null)
     {
         instance = new Singleton();
     }
     return instance;
 }
Ejemplo n.º 8
0
    // Methods
    public static Singleton Instance()
    {
        // Uses "Lazy initialization"
        if (instance == null)
            instance = new Singleton();

        return instance;
    }
Ejemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     singl = GameObject.FindGameObjectWithTag ("Singleton").GetComponent<Singleton> ();
     but = this.gameObject.GetComponent<Button> ();
     but.onClick.AddListener (() => ChangeLevel ());
     but.onClick.AddListener (() => singl.LoadScene());
     Stars ();
 }
Ejemplo n.º 10
0
		public void VerifyASingletonInstanceNotInitializedThrowTheCorrectException()
		{
			var singleton = new Singleton<Service>();

			Executing
				.This(() => singleton.Instance.Execute())
				.Should().Throw<InvalidOperationException>();
		}
Ejemplo n.º 11
0
		public void VerifyAssignANullReferenceToASingletonInstanceThrowAnArgumentNullException()
		{
			var singleton = new Singleton<Service>();

			Executing
				.This(() => singleton.Set((Service)null))
				.Should().Throw<ArgumentNullException>();
		}
Ejemplo n.º 12
0
        public static Singleton Accessor()
        {
            if (_singleton == null)
            {
                _singleton = new Singleton();
            }

            return _singleton;
        }
Ejemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     if (Instance == null) {
         Instance = this;
         DontDestroyOnLoad (this.gameObject);
     } else {
         DestroyObject (this.gameObject);
     }
 }
Ejemplo n.º 14
0
		public void VerifyASingletonInstanceCanBeAssignedOnlyOneTime()
		{
			var singleton = new Singleton<Service>(() => new Service());

			singleton.Set(() => new Service());

			Executing
				.This(() => singleton.Set(() => new Service()))
				.Should().Throw<InvalidOperationException>();
		}
Ejemplo n.º 15
0
 void Awake()
 {
     if (instance != null && instance != this) {
         Destroy(this.gameObject);
         return;
     } else {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
Ejemplo n.º 16
0
        public static Singleton Instance()
        {
            // no lazy initialization
            if (instance == null)
            {
                instance = new Singleton();
            }

            return instance;
        }
Ejemplo n.º 17
0
 void SingletonMethod()
 {
     if (instance)
     {
         DestroyImmediate (gameObject);
         return;
     }
     instance = this;
     DontDestroyOnLoad (gameObject);
 }
Ejemplo n.º 18
0
 void Start()
 {
     singl = GameObject.FindGameObjectWithTag ("Singleton").GetComponent<Singleton> ();
         GC = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();
     if (singl.Level != 10) {
         singl.Level += 1;
         this.gameObject.GetComponent<Button> ().onClick.AddListener (() => GC.loadScene (singl.Level));
     } else {
         this.gameObject.SetActive (false);
     }
 }
Ejemplo n.º 19
0
            public static Singleton Instance()
            {
                // Uses lazy initialization.
                // Note: this is not thread safe.
                if (_instance == null)
                {
                    _instance = new Singleton();
                }

                return _instance;
            }
Ejemplo n.º 20
0
		public void VerifyASingletonInstanceCannotBeChangedAfterTheFirstUsage()
		{
			var singleton = new Singleton<Service>();
			singleton.Set(() => new Service());

			singleton.Instance.Execute();

			Executing
				.This(() => singleton.Set(() => new Service()))
				.Should().Throw<InvalidOperationException>();
		}
Ejemplo n.º 21
0
 void Start()
 {
     Singleton.instance.enemySpeed = -5;
     dead=false;
     instance = this;
     DontDestroyOnLoad( this.gameObject );
     PlayerPrefs.SetInt ("score", 0);
     health = 3;
     score = 0;
     Hearts = PlayerPrefs.GetInt("Hearts");
     value = PlayerPrefs.GetInt("Coins");
 }
Ejemplo n.º 22
0
 void Awake()
 {
     if(!instance)
     {
         instance = this;
     //			DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 23
0
 public static Singleton CreateInstance()
 {
     lock (syncObject)
     {
         if (_singleton == null)
         {
             _singleton = new Singleton();
         }
     }
     
     return _singleton;
 }
Ejemplo n.º 24
0
 void Start()
 {
     if (Instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
Ejemplo n.º 25
0
	void Awake ()
	{
		if (instance == null)
	    {
	        instance = this;
	    }
	    else if (instance != this)
	    {
	        Destroy(gameObject);
	    }

	    DontDestroyOnLoad(gameObject);
	}
Ejemplo n.º 26
0
        public static Singleton GetSingleton()
        {
            lock (_lock)
            {
                // Could also do return _instance ?? (_instance = new Singleton());
                if (_instance == null)
                {
                    _instance = new Singleton();
                }

                return _instance;
            }
        }
Ejemplo n.º 27
0
    void Awake()
    {
        Debug.Log("EnSingleton Awake");
        if(_instance != null && _instance != this){
            Debug.Log("EnSingleton Destructing ");
            Destroy(this.gameObject);
            return;
        }
        _instance = this;
        DontDestroyOnLoad(this.gameObject);

        var c = GetComponents<MonoBehaviour>();
    }
Ejemplo n.º 28
0
  void Awake()
  {
    if (instance == null) 
    {
      instance = this;
    } else if (instance != this) {
      Destroy(gameObject);
    }
    
    DontDestroyOnLoad(gameObject); //this class persists between scenes
  {

}
 public static Singleton GetInstance()
 {
     // создан ли объект
     if (singletonInstance == null)
         // нет, не создан
         // только один поток может создать его 
         lock (syncRoot)
             // проверяем, не создал ли объект другой поток 
             if (singletonInstance == null)
                 // нет не создал — создаём 
                 singletonInstance = new Singleton();
     return singletonInstance;
 }
Ejemplo n.º 30
0
    public static void MainDemo()
    {
        // Constructor is protected -- cannot use new
        Singleton s1 = Singleton.Instance();
        Singleton s2 = Singleton.Instance();
      
        Singleton s3 = new Singleton();
        Singleton s4 = new Singleton();

        if (s1 == s2)
            Console.WriteLine("The same instance");

        Console.Read();
    }
Ejemplo n.º 31
0
        public ServiceResult <ApplicationUser> Login(AuthBindingModel model)
        {
            var serviceResult = new ServiceResult <ApplicationUser>();

            //check

            try
            {
                //SetConn();
                //conn.Open();

                if (LoginExist(model.Login))
                {
                    if (PasswordIsСorrect(model))
                    {
                        var instanse = Singleton.getInstance();
                        instanse.User         = GetUser(model);
                        serviceResult.Result  = instanse.User;
                        serviceResult.Success = true;
                    }
                    else
                    {
                        serviceResult.Error.ErrorCode        = 405;
                        serviceResult.Error.ErrorDescription = "Wrong password";
                    }
                }
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                serviceResult.Error.ErrorCode        = 100;
                serviceResult.Error.ErrorDescription = ex.Message;
                serviceResult.Success = false;
            }

            //conn.Close();

            return(serviceResult);
        }
Ejemplo n.º 32
0
        private void LateUpdate()
        {
            try
            {
                if (this.m_isAllSystemPrepared)
                {
                    Singleton <GameLogic> .GetInstance().LateUpdate();

                    Singleton <CBattleSystem> .GetInstance().LateUpdate();
                }
                try
                {
                    Singleton <CUIManager> .GetInstance().LateUpdate();
                }
                catch (Exception exception)
                {
                    object[] inParameters = new object[] { exception.Message, exception.StackTrace };
                    DebugHelper.Assert(false, "Exception Occur when CUIManager.LateUpdate, Message:{0}, Stack:{1}", inParameters);
                }
                if (this.m_isAllSystemPrepared)
                {
                    Singleton <LobbyLogic> .GetInstance().LateUpdate();
                }
            }
            catch (Exception exception2)
            {
                Singleton <CCheatSystem> .GetInstance().RecordErrorLog(string.Format("Exception Occur when GameFramework.LateUpdate, Message:{0}", exception2.Message));

                object[] objArray2 = new object[] { exception2.Message, exception2.StackTrace, Singleton <GameStateCtrl> .instance.currentStateName };
                DebugHelper.Assert(false, "Exception Occur when GameFramework.LateUpdate in state {2}, Message:{0}, Stack:{1}", objArray2);
                throw exception2;
            }
            if (Singleton <FrameSynchr> .instance.bShowJitterChart)
            {
                float num = Time.realtimeSinceStartup - this._DebugUpdateStart;
                MonoSingleton <RealTimeChart> .instance.AddSample("LogicTimeUse", num * 10000f);
            }
        }
Ejemplo n.º 33
0
        public static void OnReceiveRankSeasonReward(CSPkg msg)
        {
            Singleton <CUIManager> .GetInstance().CloseSendMsgAlert();

            if (msg.stPkgData.get_stGetRankRewardRsp().bErrCode == 0)
            {
                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                if (masterRoleInfo != null && Singleton <CLadderSystem> .GetInstance().currentRankDetail != null)
                {
                    Singleton <SettlementSystem> .GetInstance().SetLadderDisplayOldAndNewGrade(1u, 1u, (uint)masterRoleInfo.m_rankSeasonHighestGrade, Singleton <CLadderSystem> .GetInstance().currentRankDetail.dwScore);

                    Singleton <SettlementSystem> .GetInstance().ShowLadderSettleFormWithoutSettle();
                }
                Singleton <CLadderSystem> .GetInstance().currentRankDetail.bGetReward = 1;
            }
            else
            {
                string strContent = string.Empty;
                if (msg.stPkgData.get_stGetRankRewardRsp().bErrCode == 1)
                {
                    strContent = Singleton <CTextManager> .GetInstance().GetText("GETRANKREWARD_ERR_STATE_INVALID");
                }
                else if (msg.stPkgData.get_stGetRankRewardRsp().bErrCode == 2)
                {
                    strContent = Singleton <CTextManager> .GetInstance().GetText("GETRANKREWARD_ERR_STATE_HaveGet");
                }
                else if (msg.stPkgData.get_stGetRankRewardRsp().bErrCode == 3)
                {
                    strContent = Singleton <CTextManager> .GetInstance().GetText("GETRANKREWARD_ERR_STATE_Others");
                }
                else
                {
                    strContent = Singleton <CTextManager> .GetInstance().GetText("GETRANKREWARD_ERR_STATE_None");
                }
                Singleton <CUIManager> .GetInstance().OpenMessageBox(strContent, false);
            }
        }
Ejemplo n.º 34
0
        private void AddSpawnGroupCounter(int inCountdown, int inAlertPreroll, Vector3 inInitPos, SpawnerWrapper.ESpawnObjectType inObjType)
        {
            this.m_spawnGroupCounterContainer = this.GetSpawnGroupTextContainer();
            if (this.m_spawnGroupCounterContainer != null)
            {
                int element = this.m_spawnGroupCounterContainer.GetElement();
                if (element >= 0)
                {
                    SpawnGroupCounter counter;
                    counter = new SpawnGroupCounter {
                        CountdownTime = inCountdown,
                        timer         = counter.CountdownTime,
                        AlertTime     = counter.timer - inAlertPreroll,
                        bAlertPreroll = inAlertPreroll > 0,
                        bDidAlert     = false
                    };
                    RectTransform mapPointerRectTransform = null;
                    GameObject    p = this.m_spawnGroupCounterContainer.GetElement(element);
                    if (p != null)
                    {
                        mapPointerRectTransform = p.transform as RectTransform;
                        counter.TextObj         = p;
                        counter.timerText       = Utility.FindChild(p, "TimerText").GetComponent <Text>();
                    }
                    if (mapPointerRectTransform != null)
                    {
                        mapPointerRectTransform.SetAsFirstSibling();
                    }
                    SLevelContext curLvelContext = Singleton <BattleLogic> .GetInstance().GetCurLvelContext();

                    if ((curLvelContext != null) && curLvelContext.IsMobaMode())
                    {
                        this.UpdateUIMap(mapPointerRectTransform, inInitPos, (float)curLvelContext.m_mapWidth, (float)curLvelContext.m_mapHeight);
                    }
                    this.m_spawnGroupCounter.Add(counter);
                }
            }
        }
Ejemplo n.º 35
0
        public static bool OnSkillFuncSightArea(ref SSkillFuncContext inContext)
        {
            if (inContext.inStage == ESkillFuncStage.Enter)
            {
                PoolObjHandle <ActorRoot> inTargetObj = inContext.inTargetObj;
                if (inTargetObj)
                {
                    List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .GetInstance().HeroActors;

                    for (int i = 0; i < heroActors.get_Count(); i++)
                    {
                        ActorRoot handle = heroActors.get_Item(i).handle;
                        if (inTargetObj.handle.TheActorMeta.ActorCamp != handle.TheActorMeta.ActorCamp)
                        {
                            handle.HorizonMarker.SetEnabled(false);
                        }
                    }
                }
            }
            else if (inContext.inStage == ESkillFuncStage.Leave)
            {
                PoolObjHandle <ActorRoot> inTargetObj2 = inContext.inTargetObj;
                if (inTargetObj2)
                {
                    List <PoolObjHandle <ActorRoot> > heroActors2 = Singleton <GameObjMgr> .GetInstance().HeroActors;

                    for (int j = 0; j < heroActors2.get_Count(); j++)
                    {
                        ActorRoot handle2 = heroActors2.get_Item(j).handle;
                        if (inTargetObj2.handle.TheActorMeta.ActorCamp != handle2.TheActorMeta.ActorCamp)
                        {
                            handle2.HorizonMarker.SetEnabled(true);
                        }
                    }
                }
            }
            return(true);
        }
        private bool InternalUseSkill(ref SkillUseParam param, bool bImmediate = false)
        {
            SkillSlot skillSlot;

            if (!this.TryGetSkillSlot(param.SlotType, out skillSlot))
            {
                return(false);
            }
            skillSlot.ReadySkillObj();
            Skill skillObj = skillSlot.SkillObj;

            if (!bImmediate)
            {
                this.CurUseSkill     = skillObj;
                this.CurUseSkillSlot = skillSlot;
            }
            if (!skillObj.Use(this.actorPtr, ref param))
            {
                return(false);
            }
            skillSlot.AddSkillUseCount();
            skillSlot.NextSkillTargetIDs.Clear();
            this.SkillInfoStatistic(ref skillSlot);
            this.bIsLastAtkUseSkill = this.bIsCurAtkUseSkill;
            if (param.SlotType == SkillSlotType.SLOT_SKILL_0)
            {
                this.bIsCurAtkUseSkill = false;
            }
            else
            {
                this.bIsCurAtkUseSkill = true;
            }
            ActorSkillEventParam actorSkillEventParam = new ActorSkillEventParam(base.GetActor(), param.SlotType);

            Singleton <GameSkillEventSys> .GetInstance().SendEvent <ActorSkillEventParam>(GameSkillEventDef.AllEvent_UseSkill, base.GetActor(), ref actorSkillEventParam, GameSkillEventChannel.Channel_AllActor);

            return(true);
        }
Ejemplo n.º 37
0
    // Use this for initialization
    void Start()
    {
        towerFactory = FindObjectOfType <TowerFactory>();
        singleton    = Singleton.Instance;
        //try
        //{
        //    buttonName3.text = singleton.towerThree.buttonName;
        //}
        //catch (Exception e)
        //{
        //    // no buttonName, then it is unassigned as of yet.
        //    buttonName3.text = "Unassigned";
        //}

        if (singleton.towerThreeBase != null)
        {
            buttonName3.text = (singleton.towerThreeBase.name + "   cost: " + singleton.towerThreeBase.GetTowerCost().ToString());
        }
        else
        {
            buttonName3.text = "Unassigned";
        }
    }
Ejemplo n.º 38
0
    public string ToSnsHeadUrl(ref byte[] szUrl)
    {
        string str = StringHelper.UTF8BytesToString(ref szUrl);

        if ((str != null) && str.StartsWith("http://wx.qlogo.cn/"))
        {
            return(string.Format("{0}/{1}", str, "96"));
        }
        if ((str != null) && str.StartsWith("http://q.qlogo.cn/"))
        {
            return(string.Format("{0}/{1}", str, "100"));
        }
        switch (Singleton <ApolloHelper> .GetInstance().CurPlatform)
        {
        case ApolloPlatform.Wechat:
            return(string.Format("{0}/{1}", str, "96"));

        case ApolloPlatform.QQ:
        case ApolloPlatform.WTLogin:
            return(string.Format("{0}/{1}", str, "100"));
        }
        return(StringHelper.UTF8BytesToString(ref szUrl));
    }
Ejemplo n.º 39
0
            public void Validate()
            {
                this.title.text       = this.actvPhase.Desc;
                this.tips.text        = this.actvPhase.Tips;
                this.remainTimes.text = ((this.actvPhase.LimitTimes <= 0) ? Singleton <CTextManager> .GetInstance().GetText("noLimit") : string.Format("{0:D}/{1:D}", this.actvPhase.RemainTimes, this.actvPhase.LimitTimes));
                if (this.actvPhase.timeState == ActivityPhase.TimeState.Started)
                {
                    bool readyForGo = this.actvPhase.ReadyForGo;
                    this.gotoBtn.GetComponent <CUIEventScript>().enabled = readyForGo;
                    this.gotoBtn.GetComponent <Button>().interactable    = readyForGo;
                    this.gotoBtnTxt.text = Singleton <CTextManager> .GetInstance().GetText((!readyForGo) ? "finished" : "gotoFinish");

                    this.gotoBtnTxt.color = ((!readyForGo) ? Color.gray : Color.white);
                }
                else
                {
                    this.gotoBtn.GetComponent <CUIEventScript>().enabled = false;
                    this.gotoBtn.GetComponent <Button>().interactable    = false;
                    this.gotoBtnTxt.text = Singleton <CTextManager> .GetInstance().GetText((this.actvPhase.timeState != ActivityPhase.TimeState.Closed) ? "notInTime" : "outOfTime");

                    this.gotoBtnTxt.color = Color.gray;
                }
            }
Ejemplo n.º 40
0
 public List<PoolObjHandle<ActorRoot>> GetActorsInPolygon(GeoPolygon collisionPolygon, AreaEventTrigger InTriggerRef)
 {
     if (collisionPolygon == null)
     {
         return null;
     }
     List<PoolObjHandle<ActorRoot>> list = null;
     List<PoolObjHandle<ActorRoot>> gameActors = Singleton<GameObjMgr>.GetInstance().GameActors;
     int count = gameActors.Count;
     for (int i = 0; i < count; i++)
     {
         PoolObjHandle<ActorRoot> act = gameActors[i];
         if (((act != 0) && ((null == InTriggerRef) || InTriggerRef.ActorFilter(ref act))) && collisionPolygon.IsPointIn(act.handle.location))
         {
             if (list == null)
             {
                 list = new List<PoolObjHandle<ActorRoot>>();
             }
             list.Add(act);
         }
     }
     return list;
 }
Ejemplo n.º 41
0
        public bool IsRedBagMode()
        {
            if (this.m_pvpPlayerNum != 10)
            {
                return(false);
            }
            bool result = false;

            if (this.m_gameType == 4 || this.m_gameType == 5 || this.m_gameType == 1)
            {
                if (this.m_isWarmBattle)
                {
                    result = true;
                }
                else
                {
                    bool flag = Singleton <GamePlayerCenter> .GetInstance().IsHostPlayerHasCpuEnemy();

                    result = !flag;
                }
            }
            return(result);
        }
    protected override void Update()
    {
        if (base.isInitialize)
        {
            base.Update();
            return;
        }
        CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(Singleton <CMallSystem> .instance.sMallFormPath);

        if (form != null)
        {
            Transform transform = form.transform.FindChild("TopCommon/Button_Close");
            if (transform != null)
            {
                GameObject gameObject = transform.gameObject;
                if (gameObject.activeInHierarchy)
                {
                    base.AddHighLightGameObject(gameObject, true, form, true);
                    base.Initialize();
                }
            }
        }
    }
Ejemplo n.º 43
0
        public override void OnActorDeath(ref GameDeadEventParam prm)
        {
            if (!this.bHasComplete && prm.src && prm.src.get_handle().TheActorMeta.ActorCamp != this.CachedSelfCamp)
            {
                List <Player> .Enumerator enumerator = Singleton <GamePlayerCenter> .get_instance().GetAllPlayers().GetEnumerator();

                bool flag = true;
                while (enumerator.MoveNext())
                {
                    Player current = enumerator.get_Current();
                    if (current.PlayerCamp != this.CachedSelfCamp && !current.IsAllHeroesDead())
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag && !this.bHasComplete)
                {
                    this.bHasComplete = true;
                    this.TriggerChangedEvent();
                }
            }
        }
        protected virtual void Start()
        {
            base.Start();
            this.ItemSlotMax = !Singleton <Resources> .IsInstance() ? 0 : Singleton <Resources> .Instance.DefinePack.Recycling.CreateItemCapacity;

            DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <Unit>(Observable.Where <Unit>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable(this._deleteSubmitButton), (Func <M0, bool>)(_ => ((Behaviour)this).get_isActiveAndEnabled())), (Action <M0>)(_ =>
            {
                this.OnDeleteOKClick();
                this._recyclingUI.PlaySE(SoundPack.SystemSE.OK_L);
            })), (Component)this);
            DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <Unit>(Observable.Where <Unit>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable(this._deleteCancelButton), (Func <M0, bool>)(_ => ((Behaviour)this).get_isActiveAndEnabled())), (Action <M0>)(_ =>
            {
                this.OnDeleteCancelClick();
                this._recyclingUI.PlaySE(SoundPack.SystemSE.Cancel);
            })), (Component)this);
            DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <Unit>(Observable.Merge <Unit>((IObservable <M0>[]) new IObservable <Unit>[2]
            {
                (IObservable <Unit>)Observable.Do <Unit>(Observable.Where <Unit>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable(this._oneGetButton), (Func <M0, bool>)(_ => ((Behaviour)this).get_isActiveAndEnabled())), (Action <M0>)(_ => this.OnClickOneGet())),
                (IObservable <Unit>)Observable.Do <Unit>(Observable.Where <Unit>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable(this._allGetButton), (Func <M0, bool>)(_ => ((Behaviour)this).get_isActiveAndEnabled())), (Action <M0>)(_ => this.OnClickAllGet()))
            }), (Action <M0>)(_ => this._recyclingUI.PlaySE(SoundPack.SystemSE.OK_S))), (Component)this);
            this.ListController.RefreshEvent += (Action)(() => this.RefreshUI());
            this._itemListUI.CurrentChanged  += (Action <int, ItemNodeUI>)((currentID, nodeUI) => this.RefreshOneGetButtonInteractable(nodeUI));
        }
Ejemplo n.º 45
0
    void OnCollisionEnter(Collision col)
    {
        GameManager ins = Singleton.GetInstance().mgr;

        if (col.gameObject.name == "Enemy")
        {
            ins.enmy.health  = ins.enmy.health - 2.5f;
            ins.enmyTxt.text = ins.enmy.health.ToString();
            CheckDamage(ins.enmy.health, col.gameObject);
        }
        else
        if (col.gameObject.name == "Player")
        {
            ins.plr.health  = ins.plr.health - 2.5f;
            ins.plrTxt.text = ins.plr.health.ToString();
            CheckDamage(ins.plr.health, col.gameObject);
        }
        else
        if (col.gameObject.tag == "people")
        {
            CheckDamage(0, col.gameObject);
        }
    }
Ejemplo n.º 46
0
    private void OnCloseIDIPForm(CUIEvent uiEvent)
    {
        if (this.m_Form != null)
        {
            Singleton <CUIManager> .GetInstance().CloseForm(this.m_Form);

            this.m_Form = null;
        }
        this.m_bShow = false;
        if (((this.m_ImageContent != null) && (this.m_ImageContent.sprite != null)) && this.m_bLoadImage)
        {
            UnityEngine.Object.Destroy(this.m_ImageContent.sprite);
        }
        if (this.m_NoticeDataList.Count > 0)
        {
            this.ShowNoticeWindow(0);
        }
        else if (((Singleton <GameStateCtrl> .instance.GetCurrentState() is LobbyState) && (Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo() != null)) && (ActivitySys.NeedShowWhenLogin() && !MonoSingleton <NewbieGuideManager> .GetInstance().isNewbieGuiding))
        {
            ActivitySys.UpdateLoginShowCnt();
            Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Activity_OpenForm);
        }
    }
Ejemplo n.º 47
0
        public bool IsValidLockTargetID(uint _targetID)
        {
            bool flag = false;

            if (_targetID > 0)
            {
                PoolObjHandle <ActorRoot> actor = Singleton <GameObjMgr> .GetInstance().GetActor(_targetID);

                flag = ((((actor != 0) && !actor.handle.ObjLinker.Invincible) && (!actor.handle.ActorControl.IsDeadState && !base.actor.IsSelfCamp((ActorRoot)actor))) && actor.handle.HorizonMarker.IsVisibleFor(base.actor.TheActorMeta.ActorCamp)) && actor.handle.AttackOrderReady;
                if (!flag)
                {
                    return(flag);
                }
                long num = 0x2710L;
                num *= num;
                VInt3 num2 = base.actor.ActorControl.actorLocation - actor.handle.location;
                if (num2.sqrMagnitudeLong2D > num)
                {
                    return(false);
                }
            }
            return(flag);
        }
Ejemplo n.º 48
0
    public void StartGame(float deltaTime)
    {
        map     = new Map();
        map.col = 14;
        map.row = 16;
        map.Init(GameObject.Find("Canvas/Map").transform);

        selfEmitter = new GridEmitter();
        selfEmitter.Init(true);

        enermyEmitter = new GridEmitter();
        enermyEmitter.Init(false);

        TimeMgr timeMgr = Singleton.GetInstance("TimeMgr") as TimeMgr;

        TimeMgr.TimeEvent timeEvt = TimeMgr.TimeEvent.NewTimeEvent("SelfEmitter", SelfSpawnGrids, 0, 3);
        timeMgr.AddTimeEvent(timeEvt);

        timeEvt = TimeMgr.TimeEvent.NewTimeEvent("EnermyEmitter", EnermySpawnGrids, 0, 3);
        timeMgr.AddTimeEvent(timeEvt);

        GameObject.Find("Canvas/bg").GetComponent <SwipeRecognizer>().OnGesture += OnSwipe;
    }
Ejemplo n.º 49
0
    protected override void Update()
    {
        if (base.isInitialize)
        {
            base.Update();
            return;
        }
        CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(Singleton <CMallSystem> .instance.sMallFormPath);

        if (form != null)
        {
            Transform transform = form.transform.FindChild("pnlBodyBg/pnlSymbolGift/pnlAction/pnlSeniorBuy/btnBuyOneFree/BuyButton");
            if (transform != null)
            {
                GameObject gameObject = transform.gameObject;
                if (gameObject.activeInHierarchy)
                {
                    base.AddHighLightGameObject(gameObject, true, form, true);
                    base.Initialize();
                }
            }
        }
    }
Ejemplo n.º 50
0
        public void Init()
        {
            this.SlotType       = SkillSlotType.SLOT_SKILL_VALID;
            this.ActionName     = StringHelper.UTF8BytesToString(ref this.cfgData.szActionName);
            this.bAgeImmeExcute = (this.cfgData.bAgeImmeExcute == 1);
            this.passiveEvent   = Singleton <PassiveCreater <PassiveEvent, PassiveEventAttribute> > .GetInstance().Create((int)this.cfgData.dwPassiveEventType);

            if (this.passiveEvent == null)
            {
                return;
            }
            for (int i = 0; i < 2; i++)
            {
                int dwConditionType = (int)this.cfgData.astPassiveConditon[i].dwConditionType;
                PassiveCondition passiveCondition = Singleton <PassiveCreater <PassiveCondition, PassiveConditionAttribute> > .GetInstance().Create(dwConditionType);

                if (passiveCondition != null)
                {
                    this.passiveEvent.AddCondition(passiveCondition);
                }
            }
            this.passiveEvent.Init(this.sourceActor, this);
        }
    protected override void OnQuery_SPECIES_SEARCH_REQUEST()
    {
        int num = (int)GameSection.GetEventData();

        challengeRequest.enemySpeciesIndex      = 0;
        challengeRequest.targetEnemySpeciesName = null;
        if (Singleton <GachaSearchEnemyTable> .IsValid())
        {
            GachaSearchEnemyTable.GachaSearchEnemyData[] sortedGachaSearchEnemyData = Singleton <GachaSearchEnemyTable> .I.GetSortedGachaSearchEnemyData();

            for (int i = 0; i < sortedGachaSearchEnemyData.Length; i++)
            {
                if (num == sortedGachaSearchEnemyData[i].id)
                {
                    challengeRequest.targetEnemySpeciesName = sortedGachaSearchEnemyData[i].name;
                    break;
                }
            }
        }
        challengeRequest.order = 1;
        GameSection.SetEventData(challengeRequest);
        SendSearch();
    }
Ejemplo n.º 52
0
        public override void Init()
        {
            base.Init();
            if (this.mActorValue == null)
            {
                this.mActorValue = new PropertyHelper();
                this.mActorValue.Init(ref this.actor.TheActorMeta);
            }
            if (this.ObjValueStatistic == null)
            {
                this.ObjValueStatistic = new ActorValueStatistic();
            }
            this.mEnergy = Singleton <EnergyCreater <BaseEnergyLogic, EnergyAttribute> > .GetInstance().Create((int)this.mActorValue.EnergyType);

            if (this.mEnergy == null)
            {
                this.mEnergy = new NoEnergy();
            }
            this.mEnergy.Init(this.actorPtr);
            this.actorHp = 0;
            this.actorEp = 0;
            this.SetHpAndEpToInitialValue(10000, 10000);
        }
Ejemplo n.º 53
0
    void OnInviteGuildClick()
    {
        if (null == Singleton <ObjManager> .GetInstance().MainPlayer)
        {
            return;
        }

        if (GlobeVar.INVALID_GUID == GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid)
        {
            //你当前未加入帮会,无法邀请。
            Singleton <ObjManager> .GetInstance().MainPlayer.SendNoticMsg(false, "#{2686}");

            return;
        }

        if (m_Guid != GlobeVar.INVALID_GUID &&
            m_Guid != Singleton <ObjManager> .Instance.MainPlayer.GUID)
        {
            Singleton <ObjManager> .GetInstance().MainPlayer.ReqInviteGuild(m_Guid);
        }

        gameObject.SetActive(false);
    }
Ejemplo n.º 54
0
 public void OnReceiveRecommendListSuccess(List <stRecommendInfo> recommendList, uint totalCnt, byte pageId, byte thisCnt)
 {
     this.m_Model.AddRecommendInfoList(recommendList);
     this.m_Model.IsApplyAndRecommendListLastPage = false;
     if (CGuildHelper.IsLastPage(pageId, totalCnt, 10))
     {
         this.m_Model.IsRequestApplyList     = true;
         this.m_Model.RequestApplyListPageId = 0;
         Singleton <EventRouter> .GetInstance().BroadCastEvent("Request_Apply_List");
     }
     else
     {
         if (thisCnt == 10)
         {
             this.m_Model.RequestRecommendListPageId = pageId + 1;
         }
         else
         {
             this.m_Model.RequestRecommendListPageId = pageId;
         }
         this.m_View.RefreshApplyListPanel();
     }
 }
Ejemplo n.º 55
0
        public static void ReceiveShopBuy(CSPkg msg)
        {
            Singleton <CUIManager> .GetInstance().CloseSendMsgAlert();

            uint             dwShopID     = msg.stPkgData.stAkaliShopUpdate.dwShopID;
            uint             dwLeftBuyCnt = msg.stPkgData.stAkaliShopUpdate.dwLeftBuyCnt;
            uint             dwGoodsID    = msg.stPkgData.stAkaliShopUpdate.dwGoodsID;
            byte             bGoodsType   = msg.stPkgData.stAkaliShopUpdate.bGoodsType;
            CMallMysteryShop instance     = Singleton <CMallMysteryShop> .GetInstance();

            if (instance.ShopID == dwShopID)
            {
                instance.BoughtCnt++;
                CMallMysteryProduct product = instance.GetProduct(bGoodsType, dwGoodsID);
                if (product != null)
                {
                    uint num5;
                    instance.RefreshBanner();
                    product.BoughtCnt = (num5 = product.BoughtCnt) + 1;
                    instance.UpdateProduct(bGoodsType, dwGoodsID, num5);
                }
            }
        }
Ejemplo n.º 56
0
        public bool IsRedBagMode()
        {
            if (this.m_pvpPlayerNum != 10)
            {
                return(false);
            }
            bool result = false;

            if (this.m_gameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_LADDER || this.m_gameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_PVP_MATCH || this.m_gameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_COMBAT)
            {
                if (this.m_isWarmBattle)
                {
                    result = true;
                }
                else
                {
                    bool flag = Singleton <GamePlayerCenter> .GetInstance().IsHostPlayerHasCpuEnemy();

                    result = !flag;
                }
            }
            return(result);
        }
Ejemplo n.º 57
0
    void OnAddFriendClick()
    {
        if (null == Singleton <ObjManager> .GetInstance().MainPlayer)
        {
            return;
        }
        if (GlobeVar.INVALID_GUID != m_Guid)
        {
            //如果不是好友也不是黑名单,则添加好友
            if (false == GameManager.gameManager.PlayerDataPool.FriendList.IsExist(m_Guid))
            {
                Singleton <ObjManager> .GetInstance().MainPlayer.ReqAddFriend(m_Guid);

                return;
            }
            else
            {
                //该玩家已经是您的好友
                Singleton <ObjManager> .GetInstance().MainPlayer.SendNoticMsg(true, "#{2394}");
            }
        }
        gameObject.SetActive(false);
    }
    protected override void Update()
    {
        if (base.isInitialize)
        {
            base.Update();
            return;
        }
        CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CMatchingSystem.PATH_MATCHING_ENTRY);

        if (form != null)
        {
            Transform transform = form.transform.FindChild("panelGroup3/btnGroup/Button3");
            if (transform != null)
            {
                GameObject gameObject = transform.gameObject;
                if (gameObject.activeInHierarchy)
                {
                    base.AddHighLightGameObject(gameObject, true, form, true);
                    base.Initialize();
                }
            }
        }
    }
        private void OnMiniMap_Click_Down(CUIEvent uievent)
        {
            if (Singleton <WatchController> .instance.IsWatching)
            {
                return;
            }
            this.m_ClickDownStatus = true;
            if (Singleton <CBattleSystem> .GetInstance().FightForm != null)
            {
                CSkillButtonManager skillButtonManager = Singleton <CBattleSystem> .GetInstance().FightForm.m_skillButtonManager;

                SkillSlotType skillSlotType;
                if (skillButtonManager != null && skillButtonManager.HasMapSlectTargetSkill(out skillSlotType))
                {
                    CUIJoystickScript joystick = Singleton <CBattleSystem> .GetInstance().FightForm.GetJoystick();

                    if (joystick != null)
                    {
                        joystick.ChangeJoystickResponseArea(true);
                    }
                }
            }
        }
Ejemplo n.º 60
0
        void OnTutorialUpdated()
        {
            var isProcessed = false;
            var result      = false;

            if ((int)HideChildrenOnMask != 0 && Singleton.Get <TutorialManager> ().ValidateMask(HideChildrenOnMask))
            {
                isProcessed = true;
            }
            if (!isProcessed && (int)ShowChildrenOnMask != 0 && Singleton.Get <TutorialManager> ().ValidateMask(ShowChildrenOnMask))
            {
                isProcessed = true;
                result      = true;
            }

            if (isProcessed)
            {
                foreach (Transform child in transform)
                {
                    child.gameObject.SetActive(result);
                }
            }
        }